Skip to content

Commit

Permalink
fix(vite): cjs compatible (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhang1030 committed Apr 10, 2024
1 parent d6f13c3 commit e79114b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
19 changes: 19 additions & 0 deletions packages/vite/build.config.ts
@@ -0,0 +1,19 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/vite',
],
clean: true,
declaration: true,
externals: [
'vite',
'vite-plugin-inspect',
'vite-plugin-vue-inspector',
'execa',
],
rollup: {
emitCJS: true,
inlineDependencies: true,
},
})
4 changes: 0 additions & 4 deletions packages/vite/esbuild-shims/cjs-shim.ts
@@ -1,7 +1,3 @@
import { createRequire } from 'node:module'
import path from 'node:path'
import url from 'node:url'

globalThis.require = createRequire(import.meta.url)
globalThis.__filename = url.fileURLToPath(import.meta.url)
globalThis.__dirname = path.dirname(__filename)
2 changes: 1 addition & 1 deletion packages/vite/package.json
Expand Up @@ -43,7 +43,7 @@
"node": ">=v14.21.3"
},
"scripts": {
"build": "tsup",
"build": "unbuild",
"stub": "tsup --watch"
},
"peerDependencies": {
Expand Down

0 comments on commit e79114b

Please sign in to comment.