Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

fix: list css as side effects #57

Merged
merged 1 commit into from
Apr 12, 2019
Merged

fix: list css as side effects #57

merged 1 commit into from
Apr 12, 2019

Conversation

kristw
Copy link
Collaborator

@kristw kristw commented Apr 12, 2019

🐛 Bug Fix

Problem
related to apache/superset#7058

The root cause ends up being the sideEffects: true that is set in each package.json. webpack in production mode uses this to determine if the package has any side effects and when it is declared false, it (via treeshaking) drops the file that does not export anything, including css. Treeshaking only applies to esm so when importing lib it works fine.

Solution
Setting sideEffects: ["*.css"] seems to solve the problem.
This is an alternative solution to #55 and subset of #56.

Reference
https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free

@kristw kristw merged commit e139bcb into master Apr 12, 2019
@delete-merged-branch delete-merged-branch bot deleted the kristw--css-side-effects branch April 12, 2019 16:59
@williaster
Copy link
Contributor

wow that's tricky, nice fix 👍

nytai pushed a commit to preset-io/superset-ui-plugins that referenced this pull request Apr 27, 2020
nytai pushed a commit to preset-io/superset-ui-plugins that referenced this pull request Apr 27, 2020
lexisstv pushed a commit to utrace-ltd/superset-ui-plugins that referenced this pull request Jun 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants