File tree 2 files changed +6
-4
lines changed 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 3
3
out /
4
4
zz *
5
5
/.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 =>
118
118
typeof str === 'string' && str . length > 0
119
119
120
120
/**
121
- * A Rollup plugin that automatically declares NodeJS built-in modules,
121
+ * A Rollup/Vite plugin that automatically declares NodeJS built-in modules,
122
122
* and optionally npm dependencies, as 'external'.
123
123
*/
124
124
function nodeExternals ( options : ExternalsOptions = { } ) : Plugin {
125
125
126
126
const config : Config = { ...defaults , ...options }
127
127
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
130
130
131
131
const isIncluded = ( id : string ) => include . length > 0 && include . some ( rx => rx . test ( id ) ) ,
132
132
isExcluded = ( id : string ) => exclude . length > 0 && exclude . some ( rx => rx . test ( id ) )
133
133
134
134
return {
135
135
name : name . replace ( / ^ r o l l u p - p l u g i n - / , '' ) ,
136
136
version,
137
+ enforce : 'pre' , // For Vite
137
138
138
139
async buildStart ( ) {
139
140
@@ -258,7 +259,7 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
258
259
: null // normal handling
259
260
}
260
261
}
261
- }
262
+ } as Plugin & { enforce : 'pre' | 'post' }
262
263
}
263
264
264
265
export default nodeExternals
You can’t perform that action at this time.
0 commit comments