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[] => {
2222 const distRoot = resolve ( pkgRoot , 'dist' )
2323 const project = browserServer . project
2424
25+ let loupePath : string
26+
2527 return [
2628 {
2729 enforce : 'pre' ,
@@ -205,6 +207,16 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
205207 return resolve ( distRoot , 'client' , id . slice ( 1 ) )
206208 }
207209 } ,
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+ } ,
208220 } ,
209221 BrowserContext ( browserServer ) ,
210222 DynamicImport ( ) ,
You can’t perform that action at this time.
0 commit comments