Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production build remove meta data needed for dynamic compilation #8896

Closed
vijayanandkannan opened this issue Dec 15, 2017 · 6 comments
Closed

Comments

@vijayanandkannan
Copy link

vijayanandkannan commented Dec 15, 2017

We will close this issue if you don't provide the needed information.
For feature requests, delete the form below and describe the requirements and use case.

angular/cli: 1.6.1


Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
  Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)

Angular CLI: 1.6.1
Node: 8.2.1
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router, upgrade

@angular/cli: 1.6.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

angular-cli - 1.6.1

### Repro steps

I am enclosing the Project that is dynamic loading and lazy loaded.  

When you compile with ng build --prod, it complies the project, but I get the error when l want to load the dynamic module.

### Observed behavior

main.9e6aeb37dd5ba46c064b.bundle.js:1 ERROR Error: No NgModule metadata found for 'function (){}'.
    at t.resolve (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t.getNgModuleMetadata (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t._loadModules (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t._compileModuleAndAllComponents (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t.compileModuleAndAllComponentsSync (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t.compileModuleAndAllComponentsSync (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t.addComponent (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at t.ngAfterContentInit (0.a2f5d473ce6db5a627d2.chunk.js:1)
    at be (main.9e6aeb37dd5ba46c064b.bundle.js:1)
    at main.9e6aeb37dd5ba46c064b.bundle.js:1

### Desired behavior

What would like to see implemented?

I like to see this error go and the dynamic module loaded.

If you use ng serve then it works. The problem is only with prod build.

What is the usecase?
What did you expect to see?

Have some resolutions. Lot of us are affected with this. This is working in Angular 4... Versions.


### Mention any other details that might be useful (optional)

Enclosing the project that you can try out.
[HeroComponent.zip](https://github.com/angular/angular-cli/files/1563617/HeroComponent.zip)
@vijayanandkannan
Copy link
Author

Files not getting attached. Trying again.

HeroComponent.zip

@Toxicable
Copy link

The build optimizer is what removes metadata since it is not needed at runtime. Not Angular itself

@vijayanandkannan
Copy link
Author

@Toxicable I tried with the option --build-optimizer set to false

ng build --prod --build-optimizer=false, still it does not work. I followed the documentation as mentioned in the below link. Let me know If I miss something.

https://github.com/angular/angular-cli/blob/master/docs/documentation/build.md

image

image

-Vijay

@filipesilva filipesilva self-assigned this Dec 21, 2017
@filipesilva filipesilva added needs: investigation Requires some digging to determine if action is needed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Dec 21, 2017
@halilibrahim
Copy link

Hi,
Any progress on this?

@filipesilva filipesilva added comp: cli/build and removed needs: investigation Requires some digging to determine if action is needed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Feb 14, 2018
@ngbot ngbot bot added this to the needsTriage milestone Jan 24, 2019
@filipesilva
Copy link
Contributor

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants