Skip to content

Default import is undefined in dev, but exists in --prod #9058

@cebor

Description

@cebor

Versions

<!--
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.3
Node: 9.3.0
OS: darwin x64
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@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.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.5.3
webpack: 3.10.0

Repro steps

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->
TypeError: chartModule is not a function
    at eval (webpack-internal:///../../../../angular-highcharts/angular-highcharts.es5.js:257)
    at Array.forEach (<anonymous>)
    at ChartService.initModules (webpack-internal:///../../../../angular-highcharts/angular-highcharts.es5.js:256)
    at new ChartModule (webpack-internal:///../../../../angular-highcharts/angular-highcharts.es5.js:286)
    at _createClass (webpack-internal:///../../../core/esm5/core.js:11112)
    at _createProviderInstance$1 (webpack-internal:///../../../core/esm5/core.js:11086)
    at initNgModule (webpack-internal:///../../../core/esm5/core.js:11039)
    at new NgModuleRef_ (webpack-internal:///../../../core/esm5/core.js:12293)
    at createNgModuleRef (webpack-internal:///../../../core/esm5/core.js:12283)
    at Object.debugCreateNgModuleRef [as createNgModuleRef] (webpack-internal:///../../../core/esm5/core.js:14627)

Desired behavior

Following default import should not be undefined: https://github.com/cebor/angular-highcharts-demo/blob/master/src/app/app.module.ts#L4

Mention any other details that might be useful (optional)

  • ng serve --prod is working
  • with ng 1.6.1 all works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions