Skip to content

build on angular 5 with errors for production but developer mode works fine #8444

@Widrogo

Description

@Widrogo

Bug Report or Feature Request (mark with an x)

  • bug report -> please search issues before submitting
  • feature request

Versions.

Angular CLI: 1.5.0
Node: 8.9.1
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

angular/cli: 1.5.0
angular-devkit/build-optimizer: 0.0.32
angular-devkit/core: 0.0.20
angular-devkit/schematics: 0.0.35
ngtools/json-schema: 1.1.0
ngtools/webpack: 1.8.0
schematics/angular: 0.1.2
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

https://github.com/Widrogo/cakephp3-angular5

The project is quite new I just put a template, change what is necessary to use it with angular 5 and with ng serve me it runs without any error.

When I made the build for production it generates errors, it is because I use a modified modernizr script cakephp3-angular5/src/assets/js/modernizr.custom.32033.js it is just declared on angular-cli.json

Uncaught TypeError: Cannot read property 'html5' of undefined
at scripts.b43496ed343a01b5b3b7.bundle.js:11
at scripts.b43496ed343a01b5b3b7.bundle.js:11
at scripts.b43496ed343a01b5b3b7.bundle.js:11

I'm sure that the build causes problems because this is the only file that I handle html5 and debugging is the error here when I run the build.

For build test with different commands:

ng build --prod
ng build --prod --aot
ng build --prod --aot
ng build --prod --aot --base-href ./

And test the app with this:
ng serve --prod
give the same error that build for produccion

The log given by the failure.

Desired functionality.

I just want the build to work or production mode where it fails

Mention any other details that might be useful.

I'm using a modernzr modefied
https://stackoverflow.com/questions/47226546/modernizr-with-the-build-on-angular-5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions