{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/2965","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/2965/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/2965/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/2965/events","html_url":"https://github.com/webpack/webpack/issues/2965","id":175432947,"number":2965,"title":"vendorjs chunkhash changes on require.ensure modules","user":{"login":"paramsinghvc","id":4329912,"avatar_url":"https://avatars.githubusercontent.com/u/4329912?v=3","gravatar_id":"","url":"https://api.github.com/users/paramsinghvc","html_url":"https://github.com/paramsinghvc","followers_url":"https://api.github.com/users/paramsinghvc/followers","following_url":"https://api.github.com/users/paramsinghvc/following{/other_user}","gists_url":"https://api.github.com/users/paramsinghvc/gists{/gist_id}","starred_url":"https://api.github.com/users/paramsinghvc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paramsinghvc/subscriptions","organizations_url":"https://api.github.com/users/paramsinghvc/orgs","repos_url":"https://api.github.com/users/paramsinghvc/repos","events_url":"https://api.github.com/users/paramsinghvc/events{/privacy}","received_events_url":"https://api.github.com/users/paramsinghvc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-07T07:35:09Z","updated_at":"2016-09-07T07:49:50Z","closed_at":"2016-09-07T07:49:50Z","body":"I have been working on my react project. I had successfully implemented separation of my vendorjs and my own code in index.js with automated content based hashing versioning of the files in my `build` output folder. I have my webpack.config.js as \r\n```\r\nvar path = require('path'),\r\n    fs = require('fs'),\r\n    ejs = require('ejs');\r\nvar webpack = require('webpack');\r\nvar ManifestPlugin = require('webpack-manifest-plugin');\r\nvar HtmlWebpackPlugin = require('html-webpack-plugin');\r\n\r\nvar config = {\r\n    entry: {\r\n        index: ['./main.js'],\r\n        vendor: [\r\n            'babel-polyfill',\r\n            'jquery',\r\n            'material-ui',\r\n            'object-assign',\r\n            'react',\r\n            'react-addons-css-transition-group',\r\n            'react-dom',\r\n            'react-redux',\r\n            'react-router',\r\n            'react-tap-event-plugin',\r\n            'redux',\r\n            'redux-thunk'\r\n        ]\r\n    },\r\n    output: {\r\n        path: path.join(__dirname, '/build/'),\r\n        filename: '[name].[chunkhash].js',\r\n        chunkFilename: '[name].[chunkhash].js',\r\n        publicPath: '/build/'\r\n    },\r\n    plugins: [\r\n        new webpack.optimize.CommonsChunkPlugin({\r\n            name: 'vendor',\r\n            minChunks: Infinity\r\n        }),\r\n        new webpack.optimize.CommonsChunkPlugin('meta.[hash].js'),\r\n        new webpack.NamedModulesPlugin(),\r\n        new webpack.optimize.OccurenceOrderPlugin(),\r\n        new webpack.DefinePlugin({\r\n            'process.env': {\r\n                'NODE_ENV': JSON.stringify('production')\r\n            }\r\n        }),\r\n        // new webpack.optimize.DedupePlugin(),\r\n        new webpack.optimize.UglifyJsPlugin({\r\n            compress: { warnings: false },\r\n            comments: false,\r\n            mangle: false,\r\n            minimize: false\r\n        }),\r\n        new ManifestPlugin(),\r\n        new HtmlWebpackPlugin({\r\n            title: 'Deals',\r\n            filename: 'deals.html',\r\n            template: path.join(__dirname, '/index.ejs'),\r\n            chunksSortMode: 'dependency',\r\n            inject: false\r\n        })\r\n    ],\r\n    module: {\r\n        loaders: [{\r\n            test: /\\.jsx?$/,\r\n            exclude: /node_modules/,\r\n            loader: 'babel',\r\n\r\n            query: {\r\n                presets: ['es2015', 'react', 'stage-2']\r\n            }\r\n        }, {\r\n            test: /\\.s[ac]ss$/,\r\n            loaders: ['style', 'css', 'sass']\r\n        }]\r\n    }\r\n}\r\n\r\nmodule.exports = config;\r\n\r\n```\r\n\r\nThis config generates three files \r\n```\r\nmeta.b17560f4811dc201bd83.js\r\nvendor.ba25aa737755b6f61936.js\r\nindex.da58886945918f6a4e90.js  \r\n```\r\n\r\nwhich is fine. But yesterday I tried ti implement lazy loadin gof modules using require.ensure as:\r\n\r\n```\r\n<Route path={window.baseRoute} component={Home}>\r\n                    <Route path=\"deal/:id\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./DealDetails.js').default);\r\n                        })\r\n                    }}/>\r\n                    <Route path=\"deals_listing\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./DealsListing.js').default);\r\n                        })\r\n                    }}/>\r\n                    <Route path=\"top_stores\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./TopStoresList.js').default);\r\n                        })\r\n                    }}/>\r\n                    <Route path=\"top_categories\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./TopCategoriesList.js').default);\r\n                        })\r\n                    }}/>\r\n                    <Route path=\"saved_deals\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./SavedDeals.js').default);\r\n                        })\r\n                    }}/>\r\n                    <Route path=\"deals_near_you\"  getComponent={(nextState, callback) => {\r\n                        require.ensure([], function(require) {\r\n                            callback(null, require('./DealsNearYou.js').default);\r\n                        })\r\n                    }}/>\r\n                    <IndexRoute component={Landing} />\r\n                </Route>\r\n```\r\n\r\nAfter doing this my output is:\r\n\r\n```\r\n0.0a51c7e358997af4fff3.js    \r\n2.1554a8cd7e94490ad25f.js    \r\n3.e04fe36d074df3be415a.js    \r\n4.551b8317acd51c9297ff.js    \r\n5.54ebad8a8260b4c5907e.js    \r\n1.f0cfe1b8bdfd886ff0c9.js    \r\nmeta.2bde902b845722a6a7e2.js \r\nvendor.8b2b9599bba1820d1a87.js\r\nindex.c650c8041d9dba91ec63.js\r\n```\r\n\r\nThe vendorjs hash changes, the diff is only this \r\n\r\nbefore:\r\n`webpackJsonp([1,0],`\r\n\r\nafter: \r\n`webpackJsonp([7,6],`\r\n\r\nFrom stats I've found that the chunk with id `6` is `meta.[hash].js` & `7` is `vendor.[chunkhash].js` which were earlier 1 and 0\r\n\r\nWhy are these ids changing. I don't want it to happen. Isn't there a solution for this. I really wanna implement lazy loading of modules and don't want to change the vendorjs since its cached on production environment.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/245202881","html_url":"https://github.com/webpack/webpack/issues/2965#issuecomment-245202881","issue_url":"https://api.github.com/repos/webpack/webpack/issues/2965","id":245202881,"user":{"login":"sokra","id":1365881,"avatar_url":"https://avatars.githubusercontent.com/u/1365881?v=3","gravatar_id":"","url":"https://api.github.com/users/sokra","html_url":"https://github.com/sokra","followers_url":"https://api.github.com/users/sokra/followers","following_url":"https://api.github.com/users/sokra/following{/other_user}","gists_url":"https://api.github.com/users/sokra/gists{/gist_id}","starred_url":"https://api.github.com/users/sokra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokra/subscriptions","organizations_url":"https://api.github.com/users/sokra/orgs","repos_url":"https://api.github.com/users/sokra/repos","events_url":"https://api.github.com/users/sokra/events{/privacy}","received_events_url":"https://api.github.com/users/sokra/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T07:49:50Z","updated_at":"2016-09-07T07:49:50Z","body":"see #1315"}}
{"actor":{"display_login":"sokra"}}