DanWahlin / Angular-JumpStart

Angular and TypeScript JumpStart example application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using bundled js

abishek opened this issue · comments

When I try to run lite-server with dist/bundle.js I get this error.

zone.js:101 GET http://localhost:3000/app/customer/customer.module 404 (Not Found)

My index.html looks like this:

`
...

<script src="node_modules/core-js/client/shim.min.js"></script>

<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
....

index.html.zip

<!-- add for bundle usage -->
<script src="dist/bundle.js"></script>
<!-- add for bundle usage -->
`

How do I proceed?

I got this far, but not sure I understand how to get further.

<!-- add for bundle usage --> <script src="dist/bundle.js"></script> <!-- add for bundle usage --> <script> System.config({ packages: { '@angular': { defaultExtension: false, }, 'app': {defaultExtension: 'js'}, 'rxjs': {defaultExtension: 'js'} }, }); </script>

I think by doing this, am not using the bundle.js for loading the app. Or am running down the wrong road.

404_errors

Ok, I may have found the issue by some brute forcing :(

The npm run bundle command seems to omit the customer/* components when it bundles. Is that possible? How does this inference actually work?

I don't think I'm going to put any additional work into the bundling at this point given the release of AOT. Want to eventually move to that with tree shaking: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html