Skip to content

Commit

Permalink
Add sideEffects *.css to package.json files (#4497)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding authored Dec 13, 2024
1 parent 86d2a28 commit 0a5b68b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .changeset/perfect-icons-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@salt-ds/ag-grid-theme": patch
"@salt-ds/countries": patch
"@salt-ds/icons": patch
"@salt-ds/theme": patch
"@salt-ds/core": patch
"@salt-ds/lab": patch
---

Marked CSS files as having side effects. This fixes Webpack tree-shaking CSS files when `sideEffects: true` is not set on style-loader rules.
3 changes: 3 additions & 0 deletions packages/ag-grid-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"/fonts",
"/salt-ag-theme.css"
],
"sideEffects": [
"*.css"
],
"scripts": {
"build": "yarn node ./scripts/build.mjs",
"build-watch": "yarn node ./scripts/build.mjs --watch"
Expand Down
4 changes: 3 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
},
"bugs": "https://github.com/jpmorganchase/salt-ds/issues",
"main": "src/index.ts",
"sideEffects": false,
"sideEffects": [
"*.css"
],
"dependencies": {
"@floating-ui/react": "^0.26.5",
"@salt-ds/icons": "workspace:^",
Expand Down
4 changes: 3 additions & 1 deletion packages/countries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
},
"bugs": "https://github.com/jpmorganchase/salt-ds/issues",
"main": "src/index.ts",
"sideEffects": false,
"files": [
"saltCountries.css",
"saltSharpCountries.css",
"css"
],
"sideEffects": [
"*.css"
],
"scripts": {
"build": "yarn clean && yarn build:countries && yarn node ../../scripts/build.mjs",
"build:countries": "node ./scripts/generateCountrySymbol.mjs '*.svg'",
Expand Down
4 changes: 3 additions & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
},
"bugs": "https://github.com/jpmorganchase/salt-ds/issues",
"main": "src/index.ts",
"sideEffects": false,
"files": [
"css",
"saltIcons.css"
],
"sideEffects": [
"*.css"
],
"scripts": {
"build": "yarn clean && yarn build:icons && yarn node ../../scripts/build.mjs",
"build:icons": "yarn node ./scripts/generateIcons.mjs '*.svg'",
Expand Down
12 changes: 7 additions & 5 deletions packages/lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
},
"bugs": "https://github.com/jpmorganchase/salt-ds/issues",
"main": "src/index.ts",
"sideEffects": false,
"files": [
"css"
],
"sideEffects": [
"*.css"
],
"dependencies": {
"@floating-ui/react": "^0.26.5",
"@salt-ds/core": "workspace:^",
Expand Down Expand Up @@ -56,8 +61,5 @@
"scripts": {
"build": "yarn node ../../scripts/build.mjs",
"bundle:css": "yarn node ./scripts/build.mjs"
},
"files": [
"css"
]
}
}
3 changes: 3 additions & 0 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"/index.css",
"/css"
],
"sideEffects": [
"*.css"
],
"scripts": {
"build": "yarn node ./scripts/build.mjs",
"build:watch": "yarn node ./scripts/build.mjs --watch"
Expand Down

0 comments on commit 0a5b68b

Please sign in to comment.