angular-cli: ngtools/webpack not work with angular 5.2
I used ngtools/webpack@1.6.0 complier angular@4.3.1,all work fine,but when i upgrade ngtools/webpack to 1.9.4 and angular to 5.2. no error and waring output in complier process,the generator file only has pre line webpackJsonp([1],[function(n,exports){}],[0]);
.below is my config
paclage.json
"@angular/compiler-cli": "^5.2.0",
"@angular/platform-server": "^5.2.0",
"@ngtools/webpack": "^1.9.4",
"webpack": "^3.5.4",
"webpack-dev-server": "^2.6.1",
"webpack-merge": "^4.1.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
webpack.config(only change below)
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
module: {
rules: [
{
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
loader: '@ngtools/webpack',
}
]
},
plugins: [
new AngularCompilerPlugin({
tsConfigPath: helpers.root('tsconfig.aot.json'),
entryModule: helpers.rootAngular('/ad/app/app.module#AppModule')
})
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2015",
"es2016",
"es2017",
"dom"
],
"noEmit": true,
"skipDefaultLibCheck": true,
"removeComments": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types",
"third-type-definitions"
]
},
"angularCompilerOptions": {
"skipMetadataEmit": true
},
"compileOnSave": false,
"buildOnSave": false,
"exclude":["node_modules","output"]
}
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import {enableProdMode} from '@angular/core';
if (global['node_env'] !== 'development') {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (5 by maintainers)
Each update
@ngtools/webpack
is a painful process!I still can’t find out what went wrong,because no error or warning output in complier process.
Seems that my problem is related to something different. It appears only when an application has one main.ts file that contains the entry module definition.
main.ts
If the application follows the standard files structure with one “main.ts” file and one “app.module.ts” file the ngtools plugins works correctly with angular 5.2.
remove noEmit:true from tsconfig