Skip to content

Commit dfa7c05

Browse files
committed
fix: handle potential string quote mismatch in generated code
1 parent bc486aa commit dfa7c05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node/plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { OutputAsset, OutputChunk } from 'rollup'
1212
const hashRE = /\.(\w+)\.js$/
1313
const staticInjectMarkerRE =
1414
/\b(const _hoisted_\d+ = \/\*(?:#|@)__PURE__\*\/\s*createStaticVNode)\("(.*)", (\d+)\)/g
15-
const staticStripRE = /__VP_STATIC_START__[^]*?__VP_STATIC_END__/g
15+
const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g
1616
const staticRestoreRE = /__VP_STATIC_(START|END)__/g
1717

1818
// matches client-side js blocks in MPA mode.
@@ -224,7 +224,7 @@ export function createVitePressPlugin(
224224
bundle[name + '-lean'] = {
225225
...chunk,
226226
fileName: chunk.fileName.replace(/\.js$/, '.lean.js'),
227-
code: chunk.code.replace(staticStripRE, ``)
227+
code: chunk.code.replace(staticStripRE, `""`)
228228
}
229229

230230
// remove static markers from original code

0 commit comments

Comments
 (0)