You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build(@deephaven/icons): Properly package icons and remove unnecessary files in dist (#1437)
While updating packages consumed in the docs, I noticed our icons
`package.json` was off. It specified it was a module type (ESM), but
exported CJS as `.js`. This is incorrect as those will be interpreted as
ESM by Node. Instead we should be exporting a `.cjs` file and a `.js` or
`.mjs` as the main file.
Added an exports section to the `package.json` to indicate which file is
for ESM and which is for CJS. We still need to distribute CJS for Jest
tests.
Removed unnecessary files from the distribution. We don't use imports
like `import vsTrash from '@deephaven/icons/vsTrash';` and the ESM tree
shakes, so I removed the individual files exported. They also would have
been imported from `/icons/dist` which is bad practice. Removed the SVG
files from the files for the published package as well since they aren't
used by anything in production.
BREAKING CHANGE: Any imports/aliasing to `@deephaven/icons/dist` should
be removed and just read the package contents normally (e.g. DHE jest
and vite configs for using community packages locally). See the changes
to vite and jest configs in this change for how to update
Copy file name to clipboardExpand all lines: packages/icons/package.json
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,18 @@
3
3
"version": "0.45.0",
4
4
"description": "Icons used in Deephaven client apps. Extends vscode-codicons to be font-awesome svg-core compatible and adds additional icons in a similar style.",
5
5
"main": "dist/index.js",
6
-
"module": "dist/index.es.js",
7
-
"type": "module",
8
6
"types": "dist/index.d.ts",
7
+
"type": "module",
8
+
"exports": {
9
+
".": {
10
+
"require": "./dist/index.cjs",
11
+
"import": "./dist/index.js"
12
+
}
13
+
},
9
14
"files": [
10
-
"dist"
15
+
"dist/index.cjs",
16
+
"dist/index.js",
17
+
"dist/index.d.ts"
11
18
],
12
19
"sideEffects": false,
13
20
"scripts": {
@@ -16,9 +23,10 @@
16
23
"watch": "chokidar \"src/**/*\" -c \"npm run build\"",
0 commit comments