You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
main.css doesn't contain all css file when using code splitting #3086
changed the title [-] main.css doesn't contain all css file when using code spliting[/-][+] main.css doesn't contain all css file when using code splitting[/+]on Sep 7, 2017
@Timer Yes, this happened in production build which I care about. The size of the generated main.css is only 7KB including normalize.css, because the icons and styles are packaged into chunk files, the chunk files are quite big, some files are even larger than 100KB.
I use import(*).then for code splitting at each route. If I don't use that, the styles are all packaged into main.css correctly.
Extract from all additional chunks too (by default it extracts only from the initial chunk(s))
When using CommonsChunkPlugin and there are extracted chunks (from ExtractTextPlugin.extract) in the commons chunk, allChunks must be set to true
should it be added and set true in the config by default ? or I should eject project and add it by myself?
On production, everytime splitted chunk (component) is mounted, it will cause Flash of Unstyled component which really bad for UX.
The only solution for me is, from caller component, to define CSS animation transition from opacity 0 to 1 after few milliseconds.
@Altiano
I meet the same problem too, the worse problem is that in some place we need calculate an element's size, then do next works. So I have to set a timeout for getting the right size of an element. This makes my codes confusing...
Now I create a new git branch, then eject project and add allChunk:true to ExtractTextPlugin config for building. All css files are packaged into main.css correctly and everything works fine now.
Hey guys, this should be fixed with the mini-css-extract-plugin which we've added as part of webpack 4 in the next branch. I don't believe there will be any more releases for CRA 1.x. Please test the CRA2 release if possible, and open a new issue if you see something wrong.
Activity
[-] main.css doesn't contain all css file when using code spliting[/-][+] main.css doesn't contain all css file when using code splitting[/+]Timer commentedon Sep 7, 2017
This should happen in a production build, just not development; can you confirm?
Also, we need to know your
react-scriptsversion, etc (issue template).yqz0203 commentedon Sep 7, 2017
@Timer Yes, this happened in production build which I care about. The size of the generated
main.cssis only 7KB includingnormalize.css, because the icons and styles are packaged into chunk files, the chunk files are quite big, some files are even larger than 100KB.I use
import(*).thenfor code splitting at each route. If I don't use that, the styles are all packaged intomain.csscorrectly.My
react-scriptsversion is1.0.10Timer commentedon Sep 7, 2017
Hmm, this sounds like a bug but I'm not sure; I'll dig into this tonight.
Timer commentedon Sep 7, 2017
/cc @gaearon is this the desired behavior? A bug with
extract-text-webpack-pluginmaybe?yqz0203 commentedon Sep 8, 2017
@Timer I viewed the config code
the reason seems that a item named
allChunksnot be set.the weback doc said that
should it be added and set true in the config by default ? or I should eject project and add it by myself?
Altiano commentedon Sep 8, 2017
On production, everytime splitted chunk (component) is mounted, it will cause Flash of Unstyled component which really bad for UX.
The only solution for me is, from caller component, to define CSS animation transition from opacity 0 to 1 after few milliseconds.
yqz0203 commentedon Sep 8, 2017
@Altiano
I meet the same problem too, the worse problem is that in some place we need calculate an element's size, then do next works. So I have to set a
timeoutfor getting the right size of an element. This makes my codes confusing...Now I create a new git branch, then eject project and add
allChunk:truetoExtractTextPluginconfig for building. All css files are packaged intomain.csscorrectly and everything works fine now.Timer commentedon Sep 8, 2017
See #2415; we're ok with setting
allChunkto true; can you both confirm this fixes the flash of unstyled text?6 remaining items
bugzpodder commentedon May 31, 2018
Hey guys, this should be fixed with the mini-css-extract-plugin which we've added as part of webpack 4 in the next branch. I don't believe there will be any more releases for CRA 1.x. Please test the CRA2 release if possible, and open a new issue if you see something wrong.