styled-components-website
styled-components-website copied to clipboard
FAQ needs an update
The current FAQ has a section providing webpack configuration: https://styled-components.com/docs/faqs#running-multiple-applications-on-one-page which would not work from webpack v4 (https://webpack.js.org/plugins/split-chunks-plugin/) and requires an update for doc readers. I haven't tasted the following config but it should be something along these lines for webpack >= 4.
{
...
optimization: {
splitChunks: {
cacheGroups: {
"styled-components": {
test: /[\\/]node_modules[\\/](styled-components)[\\/]/,
chunks: 'all',
priority: 1
},
},
},
},
...
}
I found that someone has already done the work here to come up with the config: https://github.com/styled-components/styled-components/issues/2974#issuecomment-994921094.
Also, a similar config for anyone using rollup is available here: https://www.rollupjs.org/guide/en/#outputmanualchunks
manualChunks(id) {
if (id.includes('node_modules')) {
return 'vendor';
}
}
Feel free to submit a PR, thanks
@probablyup, there was already one PR https://github.com/styled-components/styled-components-website/pull/378 addressing this, but it was closed for some reason. Do we need to raise it again? We can also add a section for rollup configuration.
@harsh8398 sure, please feel free to recreate it