fix(nuxt): make dev-only regexp less greedy (#9679)

This commit is contained in:
Daniel Roe 2022-12-13 09:39:14 +00:00 committed by GitHub
parent 9cd3c16675
commit 4cf110e0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,7 @@ interface DevOnlyPluginOptions {
} }
export const DevOnlyPlugin = createUnplugin((options: DevOnlyPluginOptions) => { export const DevOnlyPlugin = createUnplugin((options: DevOnlyPluginOptions) => {
const DEVONLY_COMP_RE = /<dev-?only>(:?[\s\S]*)<\/dev-?only>/gmi const DEVONLY_COMP_RE = /<(dev-only|DevOnly)>[\s\S]*?<\/(dev-only|DevOnly)>/g
return { return {
name: 'nuxt:server-devonly:transform', name: 'nuxt:server-devonly:transform',

View File

@ -7,6 +7,8 @@
<div>RuntimeConfig | testConfig: {{ config.testConfig }}</div> <div>RuntimeConfig | testConfig: {{ config.testConfig }}</div>
<div>Composable | foo: {{ foo }}</div> <div>Composable | foo: {{ foo }}</div>
<div>Composable | bar: {{ bar }}</div> <div>Composable | bar: {{ bar }}</div>
<DevOnly>Some dev-only info</DevOnly>
<div><DevOnly>Some dev-only info</DevOnly></div>
<div>Composable | template: {{ templateAutoImport }}</div> <div>Composable | template: {{ templateAutoImport }}</div>
<div>Path: {{ $route.fullPath }}</div> <div>Path: {{ $route.fullPath }}</div>
<NuxtLink to="/"> <NuxtLink to="/">