Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't seem to fully solve the problem #11

Open
jampy opened this issue Dec 6, 2016 · 2 comments
Open

doesn't seem to fully solve the problem #11

jampy opened this issue Dec 6, 2016 · 2 comments

Comments

@jampy
Copy link

jampy commented Dec 6, 2016

Unfortunately, the chunk hash calculated by this plugin is "too stable".

Today I added added a large subtree to my application (duplicated a subdirectory to use it as a basis for something new). This subtree got it's own Webpack "chunk", as many parts of the application are loaded on-demand.

Before the change one of the Webpack chunks was named "3-chunk-0-53-48686df03dc821ceba28b976c-en.js". After the change, a new chunk with identical name was created, but with completely different content.

This caused the Webpack runtime to request chunkId "12", which simply didn't exist.

I have no clue what could be the reason for this and what is necessary to reproduce it. Anyway, the build was sensitive to the order of my requires. Just switching one of the top requires apparently fixed the problem (switching back revealed the problem again).

Luckily, changing the seed option to a different value allows me to avoid the real problem, but obviously it's not the "solution" I would hope for.

This description probably doesn't contain enough information to track down the problem (sorry, can't provide anything more useful) - but it's probably good to take note of it...

@zhenyong
Copy link
Owner

zhenyong commented Dec 7, 2016

@jampy

Today I added added a large subtree to my application (duplicated a subdirectory to use it as a basis for something new). This subtree got it's own Webpack "chunk", as many parts of the application are loaded on-demand.

Before the change one of the Webpack chunks was named "3-chunk-0-53-48686df03dc821ceba28b976c-en.js". After the change, a new chunk with identical name was created, but with completely different content.

This caused the Webpack runtime to request chunkId "12", which simply didn't exist.

Util that moment (Before you fix it).

Suppose you have subtree /A (chunk A), after you duplicate A as B (chunkB), WHAT have you done? Have you edited any content in B/** which are depended on by chunkB?

If you just copy folder /A as /B and add a new entry in webpack config, then every modules source content which are denpended on by chunkB are identical with chunkA', so

  • webpack thinks here exist chunkA and chunkB
  • but one of output chunk file is covered due to same chunk-hash (depend on sorted module file content)

And changing top requires apparently in one module file of chunkB which means change depended module file content, hence output a different chunk-hash.

@jampy
Copy link
Author

jampy commented Dec 7, 2016

Have you edited any content in B/** which are depended on by chunkB?

exactly

If you just copy folder /A as /B and add a new entry in webpack config

I did not add a new webpack config entry. Webpack does automatically creates a new chunk because I'm using require.ensure().

However, the chunks were not identical since they are dependent of different modules that are used in those chunks, only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants