mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(vite): update regex to handle new vite output format (#4014)
This commit is contained in:
parent
4c77c88325
commit
51f3bbfd23
@ -75,10 +75,10 @@ export const DynamicBasePlugin = createUnplugin(function (options: DynamicBasePl
|
||||
s.replace(/from *['"]\/__NUXT_BASE__(\/[^'"]*)['"]/g, 'from "$1"')
|
||||
|
||||
// Dynamically compute string URLs featuring baseURL
|
||||
for (const delimiter of ['`', '"', "'"]) {
|
||||
const delimiterRE = new RegExp(`(?<!const base = )${delimiter}([^${delimiter}]*)\\/__NUXT_BASE__\\/([^${delimiter}]*)${delimiter}`, 'g')
|
||||
for (const delimiter of ['`', "'", '"']) {
|
||||
const delimiterRE = new RegExp(`(?<!(const base = |from *))${delimiter}([^${delimiter}]*)\\/__NUXT_BASE__\\/([^${delimiter}]*)${delimiter}`, 'g')
|
||||
/* eslint-disable-next-line no-template-curly-in-string */
|
||||
s.replace(delimiterRE, '`$1${__publicAssetsURL()}$2`')
|
||||
s.replace(delimiterRE, r => '`' + r.replace(/\/__NUXT_BASE__\//g, '${__publicAssetsURL()}').slice(1, -1) + '`')
|
||||
}
|
||||
|
||||
if (s.hasChanged()) {
|
||||
|
Loading…
Reference in New Issue
Block a user