-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Bug Report or Feature Request (mark with an x)
- [x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0-rc.4
node: 7.4.0
os: linux x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/platform-server: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0-rc.4
@angular/compiler-cli: 2.4.10
Repro steps.
ng build --prod
The log given by the failure.
ERROR in Type PofiNumberPipe in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/util/pofi-number.pipe.ts is part of the declarations of 2 modules: SharedAppModule in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.module.ts and SharedAppModuleMocked in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.mock.module.ts! Please consider moving PofiNumberPipe in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/util/pofi-number.pipe.ts to a higher module that imports SharedAppModule in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.module.ts and SharedAppModuleMocked in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.mock.module.ts. You can also create a new NgModule that exports and includes PofiNumberPipe in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/util/pofi-number.pipe.ts then import that NgModule in SharedAppModule in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.module.ts and SharedAppModuleMocked in /home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src/app/common/shared/shared-app.mock.module.ts.
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/bootstrap/app.module.ngfactory' in '/home/ovidio/projects/belastingsportaal/projects/pofi-web/pofi-ui/src'
@ ./src/main.ts 4:0-84
@ multi ./src/main.ts
Desired functionality.
the build with aot should succeed
Mention any other details that might be useful.
The error happens when I issue a ng 'build --prod'. That means that aot is enabled by default.
In the tsconfig.app.json I have excluded some *.ts files that are used only during testing and not needed for a build.
Those are mentioned in the exclude section of the tsconfig.app.json.
As you see the shared-app.mock.module.ts containing SharedAppModuleMocked is excluded in this way.
The error above is because the shared-app.mock.module.ts declares pipes, and components that are declared as well in the SharedAppModule.
The SharedAppModule is used in the application per se.
But the shared-app.mock.module.ts is excluded and should not be taken into account when we issue a
ng build --prod. Why is it taken into account ????
My tsconfig.app.json follows as well.
{
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"lib": [
"es2016",
"dom"
],
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"/*.spec.ts",
"/.spec.page.ts",
"**/common/testing/.ts",
"app/volmacht/abstract-volmacht-testpage.ts",
"app/common/shared/shared-app.mock.module.ts",
"/*.mocked.module.ts",
"/*.mock.module.ts"
]
}