webpack-stable-module-id-and-hash icon indicating copy to clipboard operation
webpack-stable-module-id-and-hash copied to clipboard

test-pr

Open naphystart opened this issue 8 years ago • 5 comments

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.

naphystart avatar Nov 11 '16 06:11 naphystart

I didn't check it, but I bet this collision is fixed by my #5 pull request ;-)

jampy avatar Nov 11 '16 08:11 jampy

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.

zhenyong avatar Nov 11 '16 17:11 zhenyong

@jampy

Do you have any idea to fix these situation, e.p. different module with same file path.

zhenyong avatar Nov 17 '16 03:11 zhenyong

@naphystart Too busy to make more research, I will try to fix it on weekend

zhenyong avatar Nov 17 '16 03:11 zhenyong

@zhenyong

I don't really understand the problem, to be fair.

However, are you sure that #5 did not eliminate the problem already?

jampy avatar Nov 18 '16 00:11 jampy