AOT Error --- Can't find app.module
OS?
OSX - El Capitan
Versions.
angular-cli: 1.0.0-beta.17 node: 6.7.0
Repro steps.
-- Create a clean app with ng new hello
-- open src/app/index.ts
-- change line 2 from
export * from './app.module';
to
export { AppModule } from './app.module';
-- run ng build --prod --aot
The log given by the failure.
ENOENT: no such file or directory, stat '/Users/dannyblue/Documents/projects/ls-dashboard/src/app/app.module'
Error: ENOENT: no such file or directory, stat '/Users/dannyblue/Documents/projects/ls-dashboard/src/app/app.module'
at Error (native)
at Object.fs.statSync (fs.js:987:18)
at _symbolImportLookup (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/@ngtools/webpack/src/entry_resolver.js:103:28)
at Object.resolveEntryModuleFromMain (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/@ngtools/webpack/src/entry_resolver.js:148:18)
at AotPlugin._setupOptions (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/@ngtools/webpack/src/plugin.js:105:77)
at new AotPlugin (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/@ngtools/webpack/src/plugin.js:34:14)
at Object.exports.getWebpackAotConfigPartial (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/angular-cli/models/webpack-build-typescript.js:57:13)
at new NgCliWebpackConfig (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/angular-cli/models/webpack-config.js:18:42)
at Class.run (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/angular-cli/tasks/build-webpack.js:17:22)
at Class.run (/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/angular-cli/commands/build.js:50:26)
at Class.
Mention any other details that might be useful.
AOT was working fine for me in beta.16 If I change it back to a wild card the app will compile but I have two libs being served from node_modules and while the app will compile I get runtime errors such as:
Return type of public method from exported class has or is using name 'Observable' from external module "/Users/dannyblue/Documents/projects/ls-dashboard/node_modules/rxjs/Observable" but cannot be named.
Which also did not happen with beta.15. I will also point out that importing app module directly will also throw the same error at compile time.
import { AppModule } from './app/app.module';
I am curious if this has something to do with now doing the AOT compilation with a virtual file system.
Hi,
is it working for everyone? I have issues the same as described here.
This is from main.ts:
import { AppModule } from './app/app.module';
This is from index.ts:
export * from './app.component';
export * from './app.module';
And --aot is not working. Tried ng serve --aot and ng serve --prod --aot
Running "version": "1.0.0-beta.19-3"
Thanks.
It seems that it DOES work when I change this line in main.ts:
import { AppModule } from './app';
Is that a good thing to do?
I have other issues but it must be related to be AOT ready, I'm handling it but at least it's not shouting for errors right on the start.
Closing this as deprecated. This should be working now.
main.ts > import { AppModule } from './app/app.module.js';
app.module.ts > import { AppComponent } from './app.component.js';
just add .js
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.