Why externals for `ui-router` and `chart.js` doesn’t work?

I have an error when using externals as bellow:

webpack.prod.config.js:

exports.config = () => {
  entry: {
     app: '/app.js'
  },
  externals: {
    angular: 'angular',
    uiRouter: 'angular-ui-router',
   ...
  },
  ...
}

and I have imported all externals inside head of my template file.

So after that all externals have been loaded this error fired in my web console.

admin.bundle.js:1738Uncaught ReferenceError: ui is not defined

the line of error in my bundle file:

/* 63 */
/***/ (function(module, exports) {

module.exports = angular-ui-router;

/***/ }),

Author: Fantashit

1 thought on “Why externals for `ui-router` and `chart.js` doesn’t work?

  1. Sorry for bumping a closed issue, but @saeidalidadi you should try quoting 'angular-ui-router' as ' "angular-ui-router" ' . Note the additional double quotes enclosing the module name.

Comments are closed.