Css in autocomplete-theme-classic removed by Webpack due to sideEffects false?
See original GitHub issueDescription
I’m experimenting with the Autocomplete in a project that uses Webpack 5 as bundling tool. When following the getting started guide, and importing the default theme like this…
import '@algolia/autocomplete-theme-classic';
… it seems as if the contained css won’t be included in the final bundle.
Researching a bit shows that this could possibly be due to the sideEffects
setting being false
in package.json
of https://github.com/algolia/autocomplete/blob/next/packages/autocomplete-theme-classic/package.json ?
See https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Tree Shaking - webpack
All the code noted above does not contain side effects, so we can mark the property as false to inform webpack that it...
Read more >Webpack not acting on sideEffects for css files - Stack Overflow
I have a javascript module that imports a CSS file. The CSS is included in the build in webpack 'development' mode, but not...
Read more >Tree shaking JSON files with webpack - LogRocket Blog
Webpack performs out-of-the-box tree shaking when compiling multiple JSON files into a single one. Here's how and why you should use it.
Read more >Tree Shaking simplified with Webpack! - Opcito
Any unused code that can be proved is automatically dropped from your final bundle or tree shaken. To carry out the tree shaking...
Read more >Building a UI Library Capable of Tree Shaking: From A to Z
All libraries included in TOAST UI are bundled using the webpack. ... shaking cannot remove all unnecessary modules due to side effects.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this also the case if you manually import the built file?
import '@algolia/autocomplete-theme-classic/dist/theme.css';
That’s a very confusing bug, but seems like it’s more something in postcss, and not something we can help much about. In the mean time, you can likely force the version of postcss’ value parser here: https://github.com/csstools/postcss-preset-env/issues/163#issuecomment-679057151