{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/1921","labels_url":"https://api.github.com/repos/webpack/webpack/issues/1921/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/1921/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/1921/events","html_url":"https://github.com/webpack/webpack/issues/1921","id":128342461,"number":1921,"title":"Uncaught TypeError: _angular2.default.module is not a function when enable resolve.alias","user":{"login":"blackendstudios","id":4050205,"avatar_url":"https://avatars.githubusercontent.com/u/4050205?v=3","gravatar_id":"","url":"https://api.github.com/users/blackendstudios","html_url":"https://github.com/blackendstudios","followers_url":"https://api.github.com/users/blackendstudios/followers","following_url":"https://api.github.com/users/blackendstudios/following{/other_user}","gists_url":"https://api.github.com/users/blackendstudios/gists{/gist_id}","starred_url":"https://api.github.com/users/blackendstudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackendstudios/subscriptions","organizations_url":"https://api.github.com/users/blackendstudios/orgs","repos_url":"https://api.github.com/users/blackendstudios/repos","events_url":"https://api.github.com/users/blackendstudios/events{/privacy}","received_events_url":"https://api.github.com/users/blackendstudios/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webpack/webpack/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-01-23T17:52:37Z","updated_at":"2016-01-30T18:17:44Z","closed_at":null,"body":"well, this is pretty critic to me, I was trying to optimize the bundle by letting webpack to use the minified versions of the dependencies in development to make the rebundling go as fast as possible.\r\n\r\n```javascript\r\nvar path = require('path'),\r\n    webpack = require('webpack'),\r\n    node_modules = path.resolve(__dirname, 'node_modules'),\r\n    pathToAngular = path.resolve(node_modules, 'angular/angular.min.js'),\r\n    pathToAngularAnimate = path.resolve(node_modules, 'angular-animate/angular-animate.min.js'),\r\n    pathToAngularAria = path.resolve(node_modules, 'angular-aria/angular-aria.min.js'),\r\n    pathToAngularHighlightjs = path.resolve(node_modules, 'angular-highlightjs/build/angular-highlightjs.min.js'),\r\n    pathToAngularJwt = path.resolve(node_modules, 'angular-jwt/dist/angular-jwt.min.js'),\r\n    pathToAngularSanitize = path.resolve(node_modules, 'angular-sanitize/angular-sanitize.min.js'),\r\n    pathToAngularUiRouter = path.resolve(node_modules, 'angular-ui-router/build/angular-ui-router.min.js'),\r\n    pathToBootstrap = path.resolve(node_modules, 'bootstrap/dist/js/bootstrap.min.js');\r\n\r\nvar config = {\r\n   context: __dirname,\r\n   devtool: 'source-map',\r\n   entry: {\r\n      main: [\r\n         'babel-polyfill',\r\n         './client/crm/crm.js',\r\n         './client/crm/assets/stylus/styles.styl'\r\n      ],\r\n      vendors: [\r\n         'angular',\r\n         'angular-animate',\r\n         'angular-aria',\r\n         'angular-highlightjs',\r\n         'angular-jwt',\r\n         'angular-sanitize',\r\n         'angular-ui-bootstrap',\r\n         'angular-ui-router',\r\n         'bootstrap',\r\n         'core-js'\r\n      ]\r\n   },\r\n   resolve: {\r\n      alias: {\r\n         'angular': pathToAngular,\r\n         'angular-animate': pathToAngularAnimate,\r\n         'angular-aria': pathToAngularAria,\r\n         'angular-highlightjs': pathToAngularHighlightjs,\r\n         'angular-jwt': pathToAngularJwt,\r\n         'angular-sanitize': pathToAngularSanitize,\r\n         'angular-ui-router': pathToAngularUiRouter,\r\n         'bootstrap': pathToBootstrap\r\n      }\r\n   },\r\n   output: {\r\n      path: __dirname + '/client/build',\r\n      publicPath: '/',\r\n      filename: 'bundle.js'\r\n   },\r\n   module: {\r\n      preLoaders: [{test: /\\.js$/, loader: 'jshint-loader', exclude: /node_modules/}],\r\n      loaders: [\r\n         {\r\n            test: /\\.js$/,\r\n            loader: 'babel',\r\n            exclude: [\r\n               path.resolve(__dirname, 'node_modules')\r\n            ],\r\n            // Options to configure babel with\r\n            query: {\r\n               cacheDirectory: true,\r\n               plugins: ['transform-runtime'],\r\n               presets: ['es2015', 'stage-2']\r\n            }\r\n         },\r\n         {test: /\\.html$/, loader: 'html', exclude: /node_modules/},\r\n         {test: /\\.css$/,  loader: 'style!css', exclude: /node_modules/},\r\n         {test: /\\.styl$/, loader: 'style!css!stylus', exclude: /node_modules/},\r\n         {test: /\\.png/,   loader: 'url?limit=100000&mimetype=image/png' },\r\n         {test: /\\.jpg/,   loader: 'file-loader' },\r\n         {test: /\\.woff(2)?(\\?v=[0-9]\\.[0-9]\\.[0-9])?$/, loader: 'url-loader'},\r\n         {test: /\\.(ttf|eot|svg)(\\?v=[0-9]\\.[0-9]\\.[0-9])?$/, loader: 'url-loader' }\r\n      ],\r\n      noParse: [\r\n         pathToAngular,\r\n         pathToAngularAnimate,\r\n         pathToAngularAria,\r\n         pathToAngularHighlightjs,\r\n         pathToAngularJwt,\r\n         pathToAngularSanitize,\r\n         pathToAngularUiRouter,\r\n         pathToBootstrap\r\n      ]\r\n   },\r\n   plugins: [\r\n      new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),\r\n      new webpack.optimize.DedupePlugin(),\r\n      new webpack.optimize.OccurenceOrderPlugin(),\r\n      new webpack.optimize.LimitChunkCountPlugin({maxChunks: 10}),\r\n      new webpack.optimize.MinChunkSizePlugin({minChunkSize: 3000})\r\n   ]\r\n};\r\n\r\nif (process.env.NODE_ENV === 'production') {\r\n   config.output.path = __dirname + '/dist';\r\n   config.plugins.push(new webpack.optimize.UglifyJsPlugin());\r\n   config.devtool = 'source-map';\r\n}\r\n\r\nmodule.exports = config;\r\n```\r\nthe result is pretty\r\n\r\n![bundle](https://cloud.githubusercontent.com/assets/4050205/12531709/ab5cdc70-c1cf-11e5-9927-1dc5804d2582.png)\r\n\r\n\r\nbut when I run the app, I got Uncaught TypeError: _angular2.default.module.\r\n\r\n![bug](https://cloud.githubusercontent.com/assets/4050205/12531721/00ab3dfc-c1d0-11e5-9ffe-9272c5096980.png)\r\n\r\n\r\nwhy this happens only when I use functionality that I need from webpack?\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/177265529","html_url":"https://github.com/webpack/webpack/issues/1921#issuecomment-177265529","issue_url":"https://api.github.com/repos/webpack/webpack/issues/1921","id":177265529,"user":{"login":"blackendstudios","id":4050205,"avatar_url":"https://avatars.githubusercontent.com/u/4050205?v=3","gravatar_id":"","url":"https://api.github.com/users/blackendstudios","html_url":"https://github.com/blackendstudios","followers_url":"https://api.github.com/users/blackendstudios/followers","following_url":"https://api.github.com/users/blackendstudios/following{/other_user}","gists_url":"https://api.github.com/users/blackendstudios/gists{/gist_id}","starred_url":"https://api.github.com/users/blackendstudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackendstudios/subscriptions","organizations_url":"https://api.github.com/users/blackendstudios/orgs","repos_url":"https://api.github.com/users/blackendstudios/repos","events_url":"https://api.github.com/users/blackendstudios/events{/privacy}","received_events_url":"https://api.github.com/users/blackendstudios/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T18:17:44Z","updated_at":"2016-01-30T18:17:44Z","body":"@sokra @lili21 I made a small app, I remove the babel stuff, just a regular SPA with es5 using webpack, when enabling resolve.alias to bundle the minified version of angular the same error appears, so babel is not the problem\r\n\r\nhttps://github.com/blackendstudios/angular_with_webpack.git\r\n"}}