Unused code is bundled when using Angular
ErikNijland opened this issue ยท 5 comments
ErikNijland commented
What I wanted to do
I want to include @optimizely/optimizely-sdk to an existing Angular 12.1.1 project.
What I expected to happen
- No errors in the terminal when running the app with
ng serve - No errors in the terminal when building the app with
ng build - No errors in the browser console.
What actually happened
In all three scenarios the following error appears:
Warning: /my/local/path/node_modules/@optimizely/optimizely-sdk/lib/shared_types.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.
Steps to reproduce
Link to repository that can reproduce the issue: https://github.com/ErikNijland/optimizely-angular-cli-bug
- Install the NPM dependencies with
npm ci - Run
ng buildorng serve
@optimizely/optimizely-sdk version: 4.6.0
Browser and version: Chrome 91
node version: v14.17.1
npm version: 7.19.1
wpannell commented
We have the same issue. Is there an update?
tonjohn commented
How's this coming along?
JamesIves commented
I think this may be related, but Angular also throws this warning on build:
filename.ts depends on '@optimizely/optimizely-sdk'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
This is current as of version 4.9.2.
mikechu-optimizely commented
raju-opti commented
This issue is fixed in versions >= 4.9.2. Closing this issue