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

Packages are being bundled twice #629

Closed
alan-agius4 opened this issue Dec 5, 2017 · 1 comment
Closed

Packages are being bundled twice #629

alan-agius4 opened this issue Dec 5, 2017 · 1 comment

Comments

@alan-agius4
Copy link
Contributor

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

What is the current behavior?

When using @angular v4, @ngrx v4 and have the following config in tsconfig.json:

"paths": {
  "*": [
    "./node_modules/*"
  ]
}

webpack will generate incorrect output because it bundles @ngrx/store twice in the dist folder (correct ES5 bundle and the ES6 code from src folder).

Open the generated app.js and search for class Store and Store.prototype. You will see that the same code is bundled twice.

Then the app will fail with this error message:

Unhandled Promise rejection: No provider for Store! ; Zone: ; Task: Promise.then ; Value: Error: No provider for Store!

Reason: the class will be registered to the DI but EffectsModule will try to get the Store by using the ES5 function as the token.

The issue does not happen when using Angular 5 even if paths config is specified in tsconfig.

Expected behavior:

The FESM5 contents are bundled.

Minimal reproduction of the problem with instructions:

https://github.com/peterbakonyi05/angular4-ngrx4-webpack-bundling-issue

Read the readme for further explanation how to get the problem

Version of affected browser(s),operating system(s), npm, node and ngrx: all

Other information:

Angular 4.XX
NGRX 4.X.X

alan-agius4 added a commit to alan-agius4/platform that referenced this issue Dec 5, 2017
Remove `JavaScript` from `src` folder as this is not required by the consumers with `Angular 4.x.x`, `@ngtools/webpack` and `paths` in `tsconfig.json` it causes the `src` to be bundled togather with the `FESM`.

Closes: ngrx#629
@alan-agius4
Copy link
Contributor Author

@brandonroberts here's the issue mentioned earlier.

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

No branches or pull requests

1 participant