can't "ng build --prod" but I can "ng serve" and it works there
See original GitHub issueI’m submitting a … (check one with “x”)
[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
Current behavior
While I’m in dev mode (ng serve) everything works but as soon as I go to “ng build --prod” it fails. I’ve attached the stdout and stderr as a.txt here
How can you not find it in build but yes in dev ?
Expected/desired behavior
I want to be able to build it
Minimal reproduction of the problem with instructions I just described it
Environment
- Angular version: latest 4.
- For Tooling issues:
- Node version: 6.10.1 <!-- run
node --version
--> - Platform: Windows
- Others:
The file a.txt
UPDATE: In case of need of the source code find it in https://github.com/maikeldotuk/learningCMS
The commit is the one with “commented out all the ngx-meta bits” as message. You can reproduce the error by getting rid of the /* */ in app.module.ts and recompiling
Commenting out everything this is what I get when I uncomment the line below and just that one
“ERROR in C:/Users/maike/shit2/CMS/src/$$_gendir/node_modules/@ngx-meta/core/core.ngfactory.ts (10,21): Cannot find module ‘core’.”
The line:
import { MetaModule, MetaLoader, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core';
UPDATE2:
Tried too with Angular 4.4.0-RC.0 appart from Angular 4.3.6, the issue remains there.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@maikeldotuk well, happy coding
@maikeldotuk it was related with the new build system to make libraries compatible with angular-cli with universal support.
We switched from webpack to rollup in order to be able to generate all ES2015, ES5 and UMD bundles.
During this transition, the angular-quickstart-lib repo was considered as a model. All was OK, except the
moduleId
which was stuck unresolved.I line-by-line compared @ngx-meta/core with angular-quickstart-lib and @angular/core and found the clue: the
flatModuleId
value just in the tsconfig had to contain the package scope (@ngx-meta).It took some time to deploy these changes for 7 libraries with 2 branches each (to support both ng2 and ng4) but done now.
Update your deps to
4.0.1
and it should compile in prod mode without a problem.