File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
packages/browser/src/node Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
22
22
const distRoot = resolve ( pkgRoot , 'dist' )
23
23
const project = browserServer . project
24
24
25
+ let loupePath : string
26
+
25
27
return [
26
28
{
27
29
enforce : 'pre' ,
@@ -205,6 +207,16 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
205
207
return resolve ( distRoot , 'client' , id . slice ( 1 ) )
206
208
}
207
209
} ,
210
+ configResolved ( config ) {
211
+ loupePath = resolve ( config . cacheDir , 'deps/loupe.js' )
212
+ } ,
213
+ transform ( code , id ) {
214
+ if ( id . startsWith ( loupePath ) ) {
215
+ // loupe bundle has a nastry require('util') call that leaves a warning in the console
216
+ const utilRequire = 'nodeUtil = require_util();'
217
+ return code . replace ( utilRequire , ' ' . repeat ( utilRequire . length ) )
218
+ }
219
+ } ,
208
220
} ,
209
221
BrowserContext ( browserServer ) ,
210
222
DynamicImport ( ) ,
You can’t perform that action at this time.
0 commit comments