Skip to content

Commit f37df70

Browse files
committed
Add missing webpack exports
Add some entries to `package.json` to improve compatibility with webpack - Add default `style` and `sass` exports as per webpack requirements - Add `public/assets/styles/*` exports for CSS files - Add `src/styles/*` exports for Scss files. Extension can be omitted to prevent linting issues with `stylelint` - Add `*.scss` and `*.css` to "side effects" to prevent issues with tree-shaking With this commit, it is possible to import styles with the same syntax of v10 to prevent a breaking change in webpack based applications Refs: - https://webpack.js.org/guides/package-exports/ - Close Choices-js#1184
1 parent 1801a04 commit f37df70

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

package.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
".": {
1313
"types": "./public/types/src/index.d.ts",
1414
"import": "./public/assets/scripts/choices.mjs",
15-
"require": "./public/assets/scripts/choices.js"
15+
"require": "./public/assets/scripts/choices.js",
16+
"style": "./public/assets/styles/choices.css",
17+
"sass": "./src/styles/choices.scss"
1618
},
1719
"./search-basic": {
1820
"types": "./public/types/src/index.d.ts",
@@ -23,9 +25,15 @@
2325
"types": "./public/types/src/index.d.ts",
2426
"import": "./public/assets/scripts/choices.search-none.mjs",
2527
"require": "./public/assets/scripts/choices.search-none.min.js"
26-
}
28+
},
29+
"./public/assets/styles/*.css": "./public/assets/styles/*.css",
30+
"./src/styles/*.scss": "./src/styles/*.scss",
31+
"./src/styles/*": "./src/styles/*.scss"
2732
},
28-
"sideEffects": false,
33+
"sideEffects": [
34+
"*.scss",
35+
"*.css"
36+
],
2937
"scripts": {
3038
"start": "run-p js:watch css:watch",
3139
"build": "run-p js:build css:build",

0 commit comments

Comments
 (0)