File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 33out /
44zz *
55/.np-config.json
6+ /* .tgz
Original file line number Diff line number Diff line change @@ -118,22 +118,23 @@ const isString = (str: unknown): str is string =>
118118 typeof str === 'string' && str . length > 0
119119
120120/**
121- * A Rollup plugin that automatically declares NodeJS built-in modules,
121+ * A Rollup/Vite plugin that automatically declares NodeJS built-in modules,
122122 * and optionally npm dependencies, as 'external'.
123123 */
124124function nodeExternals ( options : ExternalsOptions = { } ) : Plugin {
125125
126126 const config : Config = { ...defaults , ...options }
127127
128- let include : RegExp [ ] ,
129- exclude : RegExp [ ]
128+ let include : RegExp [ ] = [ ] , // Initialized to empty arrays
129+ exclude : RegExp [ ] = [ ] // as a workaround to https://github.com/Septh/rollup-plugin-node-externals/issues/30
130130
131131 const isIncluded = ( id : string ) => include . length > 0 && include . some ( rx => rx . test ( id ) ) ,
132132 isExcluded = ( id : string ) => exclude . length > 0 && exclude . some ( rx => rx . test ( id ) )
133133
134134 return {
135135 name : name . replace ( / ^ r o l l u p - p l u g i n - / , '' ) ,
136136 version,
137+ enforce : 'pre' , // For Vite
137138
138139 async buildStart ( ) {
139140
@@ -258,7 +259,7 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
258259 : null // normal handling
259260 }
260261 }
261- }
262+ } as Plugin & { enforce : 'pre' | 'post' }
262263}
263264
264265export default nodeExternals
You can’t perform that action at this time.
0 commit comments