File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const debug = createDebugger('vite:esbuild')
2929const INJECT_HELPERS_IIFE_RE =
3030 / ^ ( .* ?) ( (?: c o n s t | v a r ) \s + \S + \s * = \s * f u n c t i o n \s * \( [ ^ ) ] * \) \s * \{ .* ?" u s e s t r i c t " ; ) / s
3131const INJECT_HELPERS_UMD_RE =
32- / ^ ( .* ?) ( \( f u n c t i o n \( [ ^ ) ] * \) \s * \{ .+ a m d .+ f u n c t i o n \( [ ^ ) ] * \) \s * \{ .* ?" u s e s t r i c t " ; ) / s
32+ / ^ ( .* ?) ( \( f u n c t i o n \( [ ^ ) ] * \) \s * \{ .+ ? a m d .+ ? f u n c t i o n \( [ ^ ) ] * \) \s * \{ .* ?" u s e s t r i c t " ; ) / s
3333
3434let server : ViteDevServer
3535
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ describe.runIf(isBuild)('build', () => {
1919 const noMinifyCode = readFile ( 'dist/nominify/my-lib-custom-filename.umd.js' )
2020 // esbuild helpers are injected inside of the UMD wrapper
2121 expect ( code ) . toMatch ( / ^ \( f u n c t i o n \( / )
22- expect ( noMinifyCode ) . toMatch ( / ^ \( f u n c t i o n \( g l o b a l / )
22+ expect ( noMinifyCode ) . toMatch (
23+ / ^ \( f u n c t i o n \( g l o b a l .+ ?" u s e s t r i c t " ; v a r .+ ?f u n c t i o n \s m y L i b \( / s,
24+ )
2325 } )
2426
2527 test ( 'iife' , async ( ) => {
Original file line number Diff line number Diff line change @@ -6,4 +6,7 @@ export default function myLib(sel) {
66
77 // Env vars should not be replaced
88 console . log ( process . env . NODE_ENV )
9+
10+ // make sure umd helper has been moved to the right position
11+ console . log ( `amd function(){ "use strict"; }` )
912}
You can’t perform that action at this time.
0 commit comments