Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused code is bundled when using Angular #686

Closed
ErikNijland opened this issue Jul 7, 2021 · 5 comments
Closed

Unused code is bundled when using Angular #686

ErikNijland opened this issue Jul 7, 2021 · 5 comments

Comments

@ErikNijland
Copy link

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 build or ng serve

@optimizely/optimizely-sdk version: 4.6.0

Browser and version: Chrome 91

node version: v14.17.1

npm version: 7.19.1

@wpannell
Copy link

We have the same issue. Is there an update?

zashraf1985 added a commit that referenced this issue May 13, 2022
…oint (#754)

## Summary
Some application were having a hard time finding `http` module being used in the node entry point. Changed the type specifications to point to browser entry point.

## Test plan
All existing tests pass

## Issues
#686
@tonjohn
Copy link

tonjohn commented Jul 13, 2022

How's this coming along?

@JamesIves
Copy link

JamesIves commented Aug 4, 2022

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
Copy link
Contributor

For the v5 release we're looking / researching whether we need to ship the CJS and UMDs any more. We'll also be sliming down by removing the /lib/ dir.

Relates to #352 and #638

@raju-opti
Copy link
Contributor

This issue is fixed in versions >= 4.9.2. Closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants