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.

webpack production build doesnt work with angular RC 5

See original GitHub issue

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
  2. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here: angular-cli: 1.0.0-beta.11-webpack.2 node: 6.3.1 os: win32 x64
  3. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. Yes. App was created using CLI. Lots of components and usage of a 3rd party library
  4. The log given by the failure. Normally this include a stack trace and some more information. Not finding component included in the app module declarations (only one giant app module including everything for now). In example below app-navbar is selector for a component include in app module directive yet I get the following error.
polyfills.c27b87b….bundle.js:2 Unhandled Promise rejection: Template parse errors:
Can't bind to 'brandNavRoute' since it isn't a known property of 'app-navbar'.
1. If 'app-navbar' is an Angular component and it has 'brandNavRoute' input, then verify that it is part of this module.
2. If 'app-navbar' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.

and in app.module I have

@NgModule({
  imports: [BrowserModule, FormsModule],
  declarations: [
    AppComponent,
    NavbarComponent,
    ...

and in NavbarComponent

@Component({
  selector: 'app-navbar',
  ...
  1. Mention any other details that might be useful.

Works fine when not given -prod flag. Worked fine with -prod with systemJS. Not 100% certain if ever used -prod with webpack and angular RC4 but likely did with no errors.


Thanks! We’ll be in touch soon.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
onedotovercommented, Aug 12, 2016

I had this issue as well. I actually think it’s related to Webpack, UglifyJS, and the mangle option.

I had to get production running quickly, so I updated webpack-build-production.ts with this

new webpack.optimize.UglifyJsPlugin({
        beautify: false, //prod
        mangle: { screw_ie8 : true, keep_fnames: true }, //prod 
        compress: { screw_ie8: true }, //prod
        comments: false //prod
      }),

Adding keep_fnames fixed the issue for me. This was only happening for me with nested components. I’m going to put together a quick test environment with a nested component to see if I can narrow down the issue and also to test the ordering solution above.

5reactions
abnercommented, Aug 12, 2016
...
mangle: { screw_ie8 : true, keep_fnames: true }, //prod

This worked for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack + Angular 2 (rc5) - components not rendering in ...
This seems to be a bug in the new RC5 release. The only workaround at the time seems to be not to minify...
Read more >
ASP.NET Core, Angular with Webpack and Visual Studio
The Webpack development build >webpack -d just uses the source files and creates outputs for development. The production build copies everything ...
Read more >
Webpack 5 Full Project Setup - YouTube
We are going for the big haul on this one. We'll start out creating a new Webpack 5 project, putting it on Github,...
Read more >
Development - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Chapter 10. Bundling and deploying applications with Webpack
Angular CLI axad oru Webpack eubdlnr ynaentillr. ... In dev mode, you'll create the bundles in memory, whereas in production mode Webpack will...
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