steveblue / angular2-rollup

CLI for bundling Angular with Rollup and Closure Compiler
121 stars 18 forks source link

issue for adding @ngrx/store #22

Closed angelo510 closed 6 years ago

angelo510 commented 6 years ago

Hi @steveblue

I am having trouble while trying to add @ngrx/store. What I've done so far I used system.js approach to add the package. I've npm installed @ngrx/core, @ngrx/store and @ngrx/dev-tools and configured system.config.js like this. '@ngrx': 'npm:@ngrx', '@ngrx/core': 'npm:@ngrx/core/bundles/core.umd.js', '@ngrx/core/compose': 'npm:@ngrx/core/compose.js', '@ngrx/core/operator/select': 'npm:@ngrx/core/operator/select.js', '@ngrx/store': 'npm:@ngrx/store/bundles/store.umd.js', '@ngrx/store-devtools': 'npm:@ngrx/store-devtools/bundles/store-devtools.umd.js', and for the packages: ' @ngrx/core': { main: 'bundles/core.umd.js', format: 'cjs' }, '@ngrx/store': { main: 'bundles/store.umd.js', format: 'cjs' }, '@ngrx/store-devtools': { main: 'bundles/store-devtools.umd.js', format: 'cjs' }

What I am getting after adding these:

zone.js:672 Unhandled Promise rejection: Unexpected token < Evaluating http://localhost:4200/node_modules/@ngrx/store/bundles/store.umd.js/bundles/store.umd.js Evaluating http://localhost:4200/src/app/app.module.js Evaluating http://localhost:4200/src/app/app.module.ngfactory.js Evaluating http://localhost:4200/main.js Loading app ; Zone: <root> ; Task: Promise.then ; Value: Error: Unexpected token < Evaluating http://localhost:4200/node_modules/@ngrx/store/bundles/store.umd.js/bundles/store.umd.js Evaluating http://localhost:4200/src/app/app.module.js Evaluating http://localhost:4200/src/app/app.module.ngfactory.js Evaluating http://localhost:4200/main.js Loading app at eval (<anonymous>) at Re (system.js:4) at system.js:4 at S (system.js:4) at E (system.js:4) at k (system.js:4) at system.js:4 at Object.eval (app.module.ts:6) at eval (app.module.ts:42) at eval (app.module.ts:42) SyntaxError: Unexpected token < at eval (<anonymous>) at Re (http://localhost:4200/lib/systemjs/dist/system.js:4:25523) at http://localhost:4200/lib/systemjs/dist/system.js:4:32657 at S (http://localhost:4200/lib/systemjs/dist/system.js:4:7538) at E (http://localhost:4200/lib/systemjs/dist/system.js:4:7038) at k (http://localhost:4200/lib/systemjs/dist/system.js:4:6037) at http://localhost:4200/lib/systemjs/dist/system.js:4:6222 at Object.eval (http://localhost:4200/src/app/app.module.js:8:15) at eval (http://localhost:4200/src/app/app.module.js:47:4) at eval (http://localhost:4200/src/app/app.module.js:48:3)

I am still not sure where I should add or how to configure more to use this packages so I would like you guide me how to add @ngrx/store in this boilerplate.

Cheers!

steveblue commented 6 years ago

Add @ngrx to ngr.config.js dep.lib and then change the system.config from referencing npm: to lib: for this package. node_modules folder in /build only populates what is needed by the AOT compiler, not your dev dependencies. @Angelo510

angelo510 commented 6 years ago

@steveblue Thanks it works!

steveblue commented 6 years ago

Closing