Skip to content

Commit e234c3f

Browse files
Add script/config for non-lib mode
I'll deploy to CF pages
1 parent 09cbcad commit e234c3f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
},
1111
"scripts": {
1212
"dev": "vite",
13-
"build": "tsc",
14-
"ci": "npm run build && npm run test && npx prettier --check lib src",
13+
"build:lib": "tsc",
14+
"build:demo": "vite --mode=demo",
15+
"ci": "npm run build:lib && npm run test && npx prettier --check lib src",
1516
"test": "vitest",
1617
"preview": "vite preview"
1718
},

vite.config.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ export default defineConfig(({ mode }) => {
1313
base: process.env.BASE_URL ?? "/",
1414
build: {
1515
sourcemap: true,
16-
lib: {
17-
// Could also be a dictionary or array of multiple entry points
18-
entry: resolve(__dirname, "lib/index.ts"),
19-
name: "MicrobitConnection",
20-
// the proper extensions will be added
21-
fileName: "microbit-connection",
22-
},
16+
// Retain the option for a regular build
17+
lib:
18+
mode === "demo"
19+
? undefined
20+
: {
21+
entry: resolve(__dirname, "lib/index.ts"),
22+
name: "MicrobitConnection",
23+
fileName: "microbit-connection",
24+
},
2325
},
2426
test: {
2527
exclude: [...configDefaults.exclude, "**/e2e/**", "build"],

0 commit comments

Comments
 (0)