File tree 3 files changed +15
-12
lines changed
3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ export default defineBuildConfig({
5
5
clean : true ,
6
6
declaration : true ,
7
7
rollup : {
8
- emitCJS : true ,
9
8
inlineDependencies : true ,
10
9
esbuild : {
11
10
target : 'node20' ,
Original file line number Diff line number Diff line change 13
13
" vite-plugin" ,
14
14
" @vitejs/plugin-legacy"
15
15
],
16
- "main" : " ./dist/index.cjs" ,
17
- "module" : " ./dist/index.mjs" ,
18
- "types" : " ./dist/index.d.ts" ,
19
- "exports" : {
20
- "." : {
21
- "import" : " ./dist/index.mjs" ,
22
- "require" : " ./dist/index.cjs"
23
- }
24
- },
16
+ "exports" : " ./dist/index.mjs" ,
25
17
"scripts" : {
26
18
"dev" : " unbuild --stub" ,
27
- "build" : " unbuild && pnpm run patch-cjs" ,
28
- "patch-cjs" : " tsx ../../scripts/patchCJS.ts" ,
19
+ "build" : " unbuild" ,
29
20
"prepublishOnly" : " npm run build"
30
21
},
31
22
"engines" : {
Original file line number Diff line number Diff line change @@ -997,3 +997,16 @@ export const cspHashes = [
997
997
export type { Options }
998
998
999
999
export default viteLegacyPlugin
1000
+
1001
+ // Compat for require
1002
+ function viteLegacyPluginCjs ( this : unknown , options : Options ) : Plugin [ ] {
1003
+ return viteLegacyPlugin . call ( this , options )
1004
+ }
1005
+ Object . assign ( viteLegacyPluginCjs , {
1006
+ cspHashes,
1007
+ default : viteLegacyPluginCjs ,
1008
+ detectPolyfills,
1009
+ } )
1010
+
1011
+ // TODO: https://github.com/unjs/unbuild/issues/533
1012
+ export { viteLegacyPluginCjs as 'module.exports' }
You can’t perform that action at this time.
0 commit comments