Skip to content

Commit 377a576

Browse files
committed
set allchunks: true for ExtractTextPlugin
1 parent 5348d6e commit 377a576

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/react-scripts/config/webpack.config.prod.js

+4
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ module.exports = {
412412
}),
413413
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
414414
new ExtractTextPlugin({
415+
// Turning this on because we want all css to be included in the main
416+
// css bundle when doing code splitting to avoid FOUC:
417+
// https://github.com/facebook/create-react-app/issues/2415
418+
allChunks: true,
415419
filename: cssFilename,
416420
}),
417421
// Generate a manifest file which contains a mapping of all asset filenames

packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ describe('Integration', () => {
1717
doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
1818
).to.match(/html\{/);
1919
expect(
20-
doc.getElementsByTagName('style')[1].textContent.replace(/\s/g, '')
20+
doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
2121
).to.match(/#feature-css-inclusion\{background:.+;color:.+}/);
22+
// we expect to only have one style tag when allChunks: true
23+
expect(doc.getElementsByTagName('style').length).to.equal(1);
2224
});
2325

2426
it('css modules inclusion', async () => {

0 commit comments

Comments
 (0)