Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: not match \n when injecting esbuild helpers #8414

Merged
merged 1 commit into from Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/esbuild.ts
Expand Up @@ -27,9 +27,9 @@ import { searchForWorkspaceRoot } from '..'
const debug = createDebugger('vite:esbuild')

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

let server: ViteDevServer

Expand Down
5 changes: 5 additions & 0 deletions playground/lib/vite.config.js
Expand Up @@ -6,6 +6,11 @@ const path = require('path')
*/
module.exports = {
build: {
rollupOptions: {
output: {
banner: `/*!\nMayLib\n*/`
}
},
lib: {
entry: path.resolve(__dirname, 'src/main.js'),
name: 'MyLib',
Expand Down