Skip to content

Commit 52d7868

Browse files
committed
Change tooling to vite build
1 parent 508fd70 commit 52d7868

5 files changed

Lines changed: 29 additions & 7 deletions

File tree

ts/examples/simple-example-ts/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/examples/simple-example-ts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"type": "module",
88
"main": "index.js",
99
"scripts": {
10-
"build": "tsc -p tsconfig.json",
11-
"dev": "cd ../.. && npm install && npm run build && npm pack && cd examples/simple-example-ts && npm install ../../code0-tech-hercules-0.0.0.tgz && npx tsx index.ts"
10+
"build": "vite build .",
11+
"start": "cd ../.. && npm install && npm run build && npm pack && cd examples/simple-example-ts && npm install && npm run build && node dist/index.js"
1212
},
1313
"dependencies": {
1414
"@code0-tech/hercules": "file:../../code0-tech-hercules-0.0.0.tgz"

ts/examples/simple-example-ts/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"baseUrl": ".",
1212
"paths": {
1313
"@code0-tech/hercules": ["../../ts"]
14-
}
14+
},
15+
"experimentalDecorators": true,
16+
"emitDecoratorMetadata": true,
17+
"types": ["vite/client"]
1518
},
1619
"include": [
1720
"index.ts"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig } from 'vite';
2+
import { resolve } from 'path';
3+
4+
export default defineConfig({
5+
build: {
6+
target: "node18",
7+
ssr: resolve(__dirname, 'index.ts'), // ✅ correct SSR entry
8+
rollupOptions: {
9+
external: (id) =>
10+
[
11+
'fs',
12+
'path',
13+
'typescript',
14+
'@code0-tech/hercules'
15+
].includes(id) || id.startsWith('node:')
16+
}
17+
}
18+
});

ts/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"target": "es2020",
77
"lib": ["es2020", "dom"],
88
"strict": true,
9-
"skipLibCheck": true
9+
"skipLibCheck": true,
10+
"types": ["vite/client"]
1011
},
1112
"include": ["src/**/*"]
1213
}

0 commit comments

Comments
 (0)