Production build does not include custom directives. Works in dev mode tho.
Please provide us with the following information:
- Ubuntu 16.04
- Versions. Please run
ng --version. If there's nothing outputted, please angular-cli: 1.0.0-beta.5 node: 4.4.5 os: linux x64 - Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? created the app with CLI no changes to the base code, build on top of the app
- The log given by the failure. Normally this include a stack trace and some more information.
zone.js:101 GET http://localhost:4200/app/trackscroll.directive.js 404 (Not Found)scheduleTask @ zone.js:101ZoneDelegate.scheduleTask @ zone.js:336Zone.scheduleMacroTask @ zone.js:273(anonymous function) @ zone.js:122send @ VM2683:3fetchTextFromURL @ system.src.js:1154(anonymous function) @ system.src.js:1735ZoneAwarePromise @ zone.js:584(anonymous function) @ system.src.js:1734(anonymous function) @ system.src.js:2759(anonymous function) @ system.src.js:3333(anonymous function) @ system.src.js:3600(anonymous function) @ system.src.js:3985(anonymous function) @ system.src.js:4448(anonymous function) @ system.src.js:4700(anonymous function) @ system.src.js:406ZoneDelegate.invoke @ zone.js:323Zone.run @ zone.js:216(anonymous function) @ zone.js:571ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256drainMicroTaskQueue @ zone.js:474ZoneTask.invoke @ zone.js:426
zone.js:461 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost:4200/app/trackscroll.directive.js
at XMLHttpRequest.wrapFn as _onreadystatechange
at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34)
Error loading http://localhost:4200/app/trackscroll.directive.js as "./app/trackscroll.directive" from http://localhost:4200/main.js ; Zone:
- Mention any other details that might be useful.
when hosting on live website, I resolve this issue by copying the
Thanks! We'll be in touch soon.
There should be no link in index.html to to any JavaScript-Class then the standard ones, angular-cli creates. All external libraries / or directives need to be loaded via SystemJS for prod-mode to work. Here are some tips, maybe they help you:
https://github.com/angular/angular-cli/issues/718#issuecomment-225493863
This is not an external library, this was a custom directive I created with angular cli, and it was bootstrapped in main.ts. but it magically disappears when compiled in production mode.
There was a problem with stuff inside of app/ that was being used in main, but it should be fixed in beta.6 due to a change in the bundling strategy.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.