fix(vite): disable assignement in replace plugin

This commit is contained in:
Daniel Roe 2023-08-08 07:07:42 +01:00
parent 4552d39c4d
commit 37ba586300

View File

@ -151,6 +151,7 @@ export async function bundle (nuxt: Nuxt) {
nuxt.hook('vite:extendConfig', (config) => { nuxt.hook('vite:extendConfig', (config) => {
config.plugins!.push(replace({ config.plugins!.push(replace({
preventAssignment: true,
...Object.fromEntries(Object.entries(config.define!).filter(([key]) => key.startsWith('process.')).map(([key, value]) => [key.replace('process.', 'import.meta.'), JSON.stringify(value)])) ...Object.fromEntries(Object.entries(config.define!).filter(([key]) => key.startsWith('process.')).map(([key, value]) => [key.replace('process.', 'import.meta.'), JSON.stringify(value)]))
})) }))
}) })