I am currently facing an issue while setting up an AOT build using Angular 2 and Webpack, although the JIT build is working perfectly. Every time I try to compile it, I encounter the following error:
ERROR in Could not resolve "src/app/app.module" from "src/app/app.module"
. Despite my attempts to troubleshoot by removing webpack plugins other than AotPlugin, experimenting with different combinations of relative and absolute paths for AotPlugin options, I have had no success so far. My current setup includes webpack 2.2.1, typescript 2.0.10, @ngtools/webpack 1.2.9, and node version 6.9.4. Any guidance or support would be greatly appreciated, thank you!
Here are snippets from my webpack.config:
module: {
rules: [
{ test: /\ts$/, loader: @'ngtools/webpack }
]
}
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new AotPlugin({
tsConfigPath: './tsconfig.json',
entryModule: 'src/app/app.module#AppModule',
mainPath: 'src/main'
}),
new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
warnings: false,
screw_ie8: true
},
comments: false
}),
new ExtractTextPlugin('[name].[hash].css'),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
})
]
Furthermore, here's a glimpse at my tsconfig.json file:
{
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"compileOnSave": false
}