Skip to content

Commit 90c153a

Browse files
committed
Update wrt vite docs
1 parent d4f7577 commit 90c153a

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

dashi/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "dashi",
3-
"private": true,
43
"version": "0.0.3",
54
"type": "module",
65
"files": ["dist"],
6+
"module": "./dist/dashi.js",
7+
"main": "./dist/dashi.umd.cjs",
78
"exports": {
89
".": {
910
"types": "./dist/index.d.ts",
10-
"module": "./dist/dashi.js"
11+
"module": "./dist/dashi.js",
12+
"require": "./dist/dashi.umd.cjs"
1113
}
1214
},
1315
"scripts": {
@@ -49,6 +51,7 @@
4951
"eslint": "^8.57.1",
5052
"eslint-plugin-react-hooks": "^4.6.2",
5153
"eslint-plugin-react-refresh": "^0.4.12",
54+
"glob": "^11.0.0",
5255
"jsdom": "^25.0.0",
5356
"prettier": "^3.3.3",
5457
"typescript": "^5.6.2",

dashi/vite.config.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export default defineConfig({
3333
sourcemap: true,
3434
lib: {
3535
entry: resolve(__dirname, "src/lib/index.ts"),
36-
formats: ["es"],
36+
name: "Dashi",
37+
// the proper extensions will be added
38+
fileName: "dashi",
3739
},
3840
rollupOptions: {
3941
// externalize deps that shouldn't be bundled into the library
@@ -42,6 +44,8 @@ export default defineConfig({
4244
"@emotion/styled",
4345
"@fontsource/roboto",
4446
"@mui/material",
47+
"@mui/system",
48+
"@mui/utils",
4549
"plotly.js",
4650
"microdiff",
4751
"react",
@@ -51,6 +55,24 @@ export default defineConfig({
5155
...excludedTestFiles,
5256
...excludedDemoFiles,
5357
],
58+
output: {
59+
// Provide global variables to use in the UMD build
60+
// for externalized deps
61+
globals: {
62+
"@emotion/react": "EmotionReact",
63+
"@emotion/styled": "EmotionStyled",
64+
"@fontsource/roboto": "FontsourceRoboto",
65+
"@mui/material": "MuiMaterial",
66+
"@mui/system": "MuiSystem",
67+
"@mui/utils": "MuiUtils",
68+
"plotly.js": "PlotlyJs",
69+
microdiff: "Microdiff",
70+
react: "React",
71+
"react-dom": "ReactDom",
72+
"react-plotly.js": "ReactPlotlyJs",
73+
zustand: "Zustand",
74+
},
75+
},
5476
},
5577
},
5678
test: {

0 commit comments

Comments
 (0)