Skip to content

Commit e79114b

Browse files
fix(vite): cjs compatible (#332)
1 parent d6f13c3 commit e79114b

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

packages/vite/build.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
3+
export default defineBuildConfig({
4+
entries: [
5+
'src/vite',
6+
],
7+
clean: true,
8+
declaration: true,
9+
externals: [
10+
'vite',
11+
'vite-plugin-inspect',
12+
'vite-plugin-vue-inspector',
13+
'execa',
14+
],
15+
rollup: {
16+
emitCJS: true,
17+
inlineDependencies: true,
18+
},
19+
})
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
import { createRequire } from 'node:module'
2-
import path from 'node:path'
3-
import url from 'node:url'
42

53
globalThis.require = createRequire(import.meta.url)
6-
globalThis.__filename = url.fileURLToPath(import.meta.url)
7-
globalThis.__dirname = path.dirname(__filename)

packages/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"node": ">=v14.21.3"
4444
},
4545
"scripts": {
46-
"build": "tsup",
46+
"build": "unbuild",
4747
"stub": "tsup --watch"
4848
},
4949
"peerDependencies": {

0 commit comments

Comments
 (0)