I used ngtools/[email protected] complier [email protected],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);
I have no problem with my template https://github.com/wKoza/simple-angular-starter that uses @ngtools/webpack.
@wKoza i compared your code,can't find any issuse,webpack generator file only has one line
webpackJsonp([1],[function(n,exports){}],[0]);
@ngtools/webpack is a painful process!I still can't find out what went wrong,because no error or warning output in complier process.
I didn't find any solution,so decide degrade to angular 4.3.
@keyiis, do you have tested your application code in my template ?
@wKoza I already changed config same as your config exclude some path and file's name.i will create a repo to reproduce the issuse,but my app is too big,so need take some time to dismantle.
@wKoza When i upgrade to 5.2,all work fine with JIT mode,so i think the issuse mybe in ngtools/webpack,but no error output in log,so i can't find any clues to solve the problem.
Same problem for me. As far as i can see seems that in the factory during bootstrap the moduleType is undefined
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
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
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
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.
Ok that's valuable information. It sounds like a bug with how we replace the bootstrap for AOT.
remove noEmit:true from tsconfig
I also encountered this issue. I can confirm that moving the bootstrap call to another file works around the problem.
I had the same issue here, I changed the AOTPlugin config. Instead of using entryModule, I'm using mainPath. It's solved the issue.
+1
remove noEmit:true from tsconfig
it work for me,big thanks!
Looks like a problem with old version of the CLI. Let us close the issue for now. If it's still relevant, please open a new ticket with steps to reproduce and a minimal demo. Thanks!
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._
Most helpful comment
Each update
@ngtools/webpackis a painful process!I still can't find out what went wrong,because no error or warning output in complier process.