webpack-stable-module-id-and-hash
webpack-stable-module-id-and-hash copied to clipboard
test-pr
I add a demo and I found out an Error: webpack-stable-module-id-and-hash module id collision, which is not show up in my project. I am sorry for adding this demo so late due to the 11.11 festival.
I didn't check it, but I bet this collision is fixed by my #5 pull request ;-)
Experiment
webpack config:
module: {
loaders: [
{
test: require.resolve('jquery'),
loader: "expose?aa!expose?bb!expose?cc",
},
]
},
plugins: [
// new webpack.ProvidePlugin({
// ...
// }),
new StableModuleIdAndHash(),
],
So then expose-loader may "expose" extra modules to make aa bb cc global
module.exports = global["aa"] = require("-!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/expose-loader/index.js?bb!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/expose-loader/index.js?cc!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/jquery/dist/jquery.js");
-------
module.exports = global["bb"] = require("-!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/expose-loader/index.js?cc!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/jquery/dist/jquery.js");
-------
module.exports = global["cc"] = require("-!/Users/zhenyong/codes/webpackmoduleidhash/jquery_issue_demo/node_modules/jquery/dist/jquery.js");
Log all module path in the plugin:
./node_modules/jquery/dist/jquery.js
./node_modules/expose-loader/index.js?bb!./node_modules/expose-loader/index.js?cc!./node_modules/jquery/dist/jquery.js
./node_modules/expose-loader/index.js?cc!./node_modules/jquery/dist/jquery.js
./node_modules/jquery/dist/jquery.js
The first one is same as last one, therefore collision error.
I think the first line should be like follow:
./node_modules/expose-loader/index.js?aa!./node_modules/expose-loader/index.js?bb!./node_modules/expose-loader/index.js?cc!./node_modules/jquery/dist/jquery.js
But it doesn't.
I will continue make research.
@jampy
Do you have any idea to fix these situation, e.p. different module with same file path.
@naphystart Too busy to make more research, I will try to fix it on weekend
@zhenyong
I don't really understand the problem, to be fair.
However, are you sure that #5 did not eliminate the problem already?