From 0a5b68b7cda36ed74b6214682bb9471202916546 Mon Sep 17 00:00:00 2001 From: Josh Wooding <12938082+joshwooding@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:55:09 +0000 Subject: [PATCH] Add sideEffects *.css to package.json files (#4497) --- .changeset/perfect-icons-whisper.md | 10 ++++++++++ packages/ag-grid-theme/package.json | 3 +++ packages/core/package.json | 4 +++- packages/countries/package.json | 4 +++- packages/icons/package.json | 4 +++- packages/lab/package.json | 12 +++++++----- packages/theme/package.json | 3 +++ 7 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 .changeset/perfect-icons-whisper.md diff --git a/.changeset/perfect-icons-whisper.md b/.changeset/perfect-icons-whisper.md new file mode 100644 index 00000000000..c6479f5211c --- /dev/null +++ b/.changeset/perfect-icons-whisper.md @@ -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. diff --git a/packages/ag-grid-theme/package.json b/packages/ag-grid-theme/package.json index a144021670a..a5fb4238257 100644 --- a/packages/ag-grid-theme/package.json +++ b/packages/ag-grid-theme/package.json @@ -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" diff --git a/packages/core/package.json b/packages/core/package.json index fb4a8a125ab..f62710e5224 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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:^", diff --git a/packages/countries/package.json b/packages/countries/package.json index 87e7593c156..78d6537b360 100644 --- a/packages/countries/package.json +++ b/packages/countries/package.json @@ -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'", diff --git a/packages/icons/package.json b/packages/icons/package.json index 10fce190e72..d9d47d48b29 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -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'", diff --git a/packages/lab/package.json b/packages/lab/package.json index cea3ad86e60..1f3102d8b26 100644 --- a/packages/lab/package.json +++ b/packages/lab/package.json @@ -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:^", @@ -56,8 +61,5 @@ "scripts": { "build": "yarn node ../../scripts/build.mjs", "bundle:css": "yarn node ./scripts/build.mjs" - }, - "files": [ - "css" - ] + } } diff --git a/packages/theme/package.json b/packages/theme/package.json index 88e938d58ba..cd10694866b 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -13,6 +13,9 @@ "/index.css", "/css" ], + "sideEffects": [ + "*.css" + ], "scripts": { "build": "yarn node ./scripts/build.mjs", "build:watch": "yarn node ./scripts/build.mjs --watch"