You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ng --version
(node:12872) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
angular-cli: 1.0.0-beta.10
node: 6.7.0
os: win32 x64
We've only started to support AoT compilation in beta16/17 with the --aot flag in the serve and build commands (and it's still under testing). There was no support at all in beta.10.
Component-relative Template URLS
The AoT compiler requires that @component URLS for external templates and css files be component-relative. That means that the value of @Component.templateUrl is a URL value relative to the component class file. For example, an 'app.component.html' URL means that the template file is a sibling of its companion app.component.ts file.
Ok, so that's fine. Instead of 'app/app.component.html you use app.component.html. But if you do this you can no longer debug the application because you will get an error that the file ~/app.component.html does not exist.
So, the docs say:
JiT-compiled applications that use the SystemJS loader and component-relative URLs must set the @Component.moduleId property to module.id. The module object is undefined when an AoT-compiled app runs. The app fails with a null reference error unless you assign a global module value in the index.html like this:
I have no idea what this means. There are no samples that show this. Where do you set moduleId? what is the id of the module?
Thanks to Visual Studio go to definition, I found that an NgModule has an id?: string property. and that the Component has a moduleId?: string property.
Even with these changes, and adding window.module = 'aot'; to the script of the index page it still tries to get the html file relative to the host server
Any solutions? I want to use JIT for development and AOT for production using SystemJS but have to manually add/remove the __moduleName property for both.
angular-automatic-lock-bot commented on Sep 7, 2019
Activity
filipesilva commentedon Oct 10, 2016
We've only started to support AoT compilation in beta16/17 with the
--aotflag in theserveandbuildcommands (and it's still under testing). There was no support at all in beta.10.NiceGuyNimni commentedon Nov 2, 2016
I have the same issue in @angular/compiler-cli": "^2.1.2
Any ideas?
skendrot commentedon Dec 13, 2016
Up?! Seeing this with 2.2.4
skendrot commentedon Dec 13, 2016
Found this in the docs:
Ok, so that's fine. Instead of
'app/app.component.htmlyou useapp.component.html. But if you do this you can no longer debug the application because you will get an error that the file ~/app.component.html does not exist.So, the docs say:
I have no idea what this means. There are no samples that show this. Where do you set moduleId? what is the id of the module?
skendrot commentedon Dec 13, 2016
Thanks to Visual Studio go to definition, I found that an NgModule has an
id?: stringproperty. and that the Component has amoduleId?: stringproperty.In the Component:
Even with these changes, and adding
window.module = 'aot';to the script of the index page it still tries to get the html file relative to the host serverskendrot commentedon Dec 18, 2016
Filed issue: angular/angular#13553
baigali93 commentedon Jul 17, 2017
Any solutions? I want to use JIT for development and AOT for production using SystemJS but have to manually add/remove the __moduleName property for both.
angular-automatic-lock-bot commentedon Sep 7, 2019
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.