@@ -11,6 +11,8 @@ import resolve from "@rollup/plugin-node-resolve";
11
11
import vue from "rollup-plugin-vue" ;
12
12
import styles from "rollup-plugin-styles" ;
13
13
import externals from "rollup-plugin-node-externals" ;
14
+ import { rolldown } from 'rolldown'
15
+ import nodePolyfills from '@rolldown/plugin-node-polyfills'
14
16
15
17
export interface WriteData {
16
18
input : string | string [ ] ;
@@ -45,32 +47,44 @@ export const fixture = (...args: string[]): string =>
45
47
export async function write ( data : WriteData ) : Promise < WriteResult > {
46
48
const outDir = fixture ( "dist" , data . outDir ?? data . title ?? "" ) ;
47
49
const input = Array . isArray ( data . input ) ? data . input . map ( i => fixture ( i ) ) : fixture ( data . input ) ;
48
- const bundle = await rollup ( {
49
- ...data . inputOpts ,
50
+ // const bundle = await rollup({
51
+ // ...data.inputOpts,
52
+ // input,
53
+ // plugins: [
54
+ // externals({ deps: true }),
55
+ // json(),
56
+ // resolve({
57
+ // preferBuiltins: true,
58
+ // dedupe: [
59
+ // "vue",
60
+ // "@vue/compiler-core",
61
+ // "@vue/compiler-dom",
62
+ // "@vue/compiler-sfc",
63
+ // "@vue/compiler-ssr",
64
+ // "@vue/reactivity",
65
+ // "@vue/runtime-core",
66
+ // "@vue/runtime-dom",
67
+ // "@vue/shared",
68
+ // ],
69
+ // }),
70
+ // vue3ui({ debug: true }),
71
+ // vue({ preprocessStyles: false }),
72
+ // styles({ mode: "extract" }),
73
+ // ],
74
+ // });
75
+ const bundle = await rolldown ( {
76
+ // ... other config
50
77
input,
51
78
plugins : [
52
- externals ( { deps : true } ) ,
53
- json ( ) ,
54
- resolve ( {
55
- preferBuiltins : true ,
56
- dedupe : [
57
- "vue" ,
58
- "@vue/compiler-core" ,
59
- "@vue/compiler-dom" ,
60
- "@vue/compiler-sfc" ,
61
- "@vue/compiler-ssr" ,
62
- "@vue/reactivity" ,
63
- "@vue/runtime-core" ,
64
- "@vue/runtime-dom" ,
65
- "@vue/shared" ,
66
- ] ,
79
+ nodePolyfills ( {
80
+ // Optional configuration
81
+ include : [ 'fs' , 'path' ] , // Only polyfill specific modules
82
+ exclude : [ 'crypto' ] , // Exclude modules from polyfilling
67
83
} ) ,
68
- vue3ui ( { debug : true } ) ,
69
- vue ( { preprocessStyles : false } ) ,
70
- styles ( { mode : "extract" } ) ,
84
+ // ... other plugins
71
85
] ,
72
- } ) ;
73
-
86
+ platform : 'node' // Important for Node.js polyfilling
87
+ } )
74
88
const { output } = await bundle . write ( {
75
89
...data . outputOpts ,
76
90
dir : data . outputOpts ?. file ? undefined : outDir ,
0 commit comments