Skip to content

Commit 5a57626

Browse files
authoredJun 1, 2022
fix: not match \n when injecting esbuild helpers (#8414)
1 parent 8a68fbd commit 5a57626

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎packages/vite/src/node/plugins/esbuild.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import { searchForWorkspaceRoot } from '..'
2727
const debug = createDebugger('vite:esbuild')
2828

2929
const INJECT_HELPERS_IIFE_RE =
30-
/(.*)((?:const|var) [^\s]+=function\([^)]*?\){"use strict";)(.*)/
30+
/(.*)((?:const|var) [^\s]+=function\([^)]*?\){"use strict";)(.*)/s
3131
const INJECT_HELPERS_UMD_RE =
32-
/(.*)(\(function\([^)]*?\){.+amd.+function\([^)]*?\){"use strict";)(.*)/
32+
/(.*)(\(function\([^)]*?\){.+amd.+function\([^)]*?\){"use strict";)(.*)/s
3333

3434
let server: ViteDevServer
3535

‎playground/lib/vite.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ const path = require('path')
66
*/
77
module.exports = {
88
build: {
9+
rollupOptions: {
10+
output: {
11+
banner: `/*!\nMayLib\n*/`
12+
}
13+
},
914
lib: {
1015
entry: path.resolve(__dirname, 'src/main.js'),
1116
name: 'MyLib',

0 commit comments

Comments
 (0)
Please sign in to comment.