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

set allchunks: true for ExtractTextPlugin #3908

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ module.exports = {
}),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin({
// Turning this on because we want all css to be included in the main
// css bundle when doing code splitting to avoid FOUC:
// https://github.com/facebook/create-react-app/issues/2415
allChunks: true,
filename: cssFilename,
}),
// Generate a manifest file which contains a mapping of all asset filenames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ describe('Integration', () => {
doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
).to.match(/html\{/);
expect(
doc.getElementsByTagName('style')[1].textContent.replace(/\s/g, '')
doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just realize that this only test the style-loader behaviour in test and dev mode, need to revert this and find out how to test the behaviour for npm run build output

).to.match(/#feature-css-inclusion\{background:.+;color:.+}/);
// we expect to only have one style tag when allChunks: true
expect(doc.getElementsByTagName('style').length).to.equal(1);
});

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