question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't "ng build --prod" but I can "ng serve" and it works there

See original GitHub issue

I’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

capture 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:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fulls1z3commented, Sep 7, 2017

@maikeldotuk well, happy coding

1reaction
fulls1z3commented, Sep 7, 2017

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 4: ng serve work well but ng build --prod fails
When I tried to run ng serve it runs without any error, but when I tried to create a production build using '...
Read more >
Error in ng build --prod that doesn't happen with ng serve --prod
When I serve the app via ng serve --prod the app runs fine. When I serve the files outputted by with a server...
Read more >
ng serve fails but ng build works : r/angular - Reddit
If I remember correctly, Angular will serve your application using the production configuration. This means that your build will be highly ...
Read more >
Identify and Fix Build and Deployment Errors in Your Angular ...
Many common build errors may occur as a result of rebuilding your app while using ng serve or running ng build or ng...
Read more >
How To Run The Angular Service Worker In Production Mode
I can't get Chrome to work but Firefox works and I only need 1 dev browser. ng build --prod && cd dist &&...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found