Does not work when chunkName is not identical with what babel plugin generates when using flushChunkNames()
See original GitHub issueI am trying to break down a few issues in all these packages to try to improve docs or just understand it better on my own.
One thing I noticed is that the chunkName
I assign in options has direct influence on the file names being produced - I figure that’s used for the [name]
part of the chunkFilename. That makes one thing quite unfortunate: the output matches the file structure and naming of the sources e.g. when importing ./views/main/Main
the chunkName generated by the Babel-Dual-Import-Plugin is views/main/Main
which produces and output inside the build folder of views/main/Main.js+css
.
What I like to have instead is a flat structure of files inside the build directory. I assumed that I can just change the chunkName
part inside the universal
options but unfortunately this does not work. It even breaks - without any warning. It just seems to be unable to match the chunkNames
to the files correctly and ignores the affected universal module.
Interestingly it seems to be possible to fix at the this last issue by using flushModuleIds()
instead of flushChunkNames()
from the server part of this library. I wonder why we chose one or another.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (16 by maintainers)
Top GitHub Comments
…by the way i reverted back to my previous thing (which was the second thinking in the grand scheme of things) to use
chunkNames
. The reasons are:chunkName
option0.js
makes it easier for developers to know the system is working. With numbered chunks you are less likely to know if the correct chunk was served.The cons are:
chunkName
option and thewebpackMode
commentThe cons ultimately are less significant and after the PR to webpack it’s clear to me that webpack is focusing on the chunkName strategy. It’s working solidly in all places. We should start using it. The interface of a magic comment sucks in my opinion. Automated is the correct way, and guess what, we do that!
We have the unique luxury to do that whereas webpack itself doesnt since it doesn’t handle rendering. Because we handle rendering we can remove all chunk naming from the user’s hands.
When
universal-render
comes out next week, you will no longer flush chunk names from react-universal-component. u just will just flush chunks and all will happen for you.I’ll think of something tho. New angles always open up