mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
feat(vite): replace global
with globalThis
(#4958)
This commit is contained in:
parent
8767b7e3e1
commit
17f9c54a79
@ -20,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/kit": "^3.0.0-rc.3",
|
"@nuxt/kit": "^3.0.0-rc.3",
|
||||||
|
"@rollup/plugin-replace": "^4.0.0",
|
||||||
"@vitejs/plugin-vue": "^2.3.3",
|
"@vitejs/plugin-vue": "^2.3.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||||
"autoprefixer": "^10.4.7",
|
"autoprefixer": "^10.4.7",
|
||||||
|
@ -4,6 +4,7 @@ import type { Nuxt } from '@nuxt/schema'
|
|||||||
import type { InlineConfig, SSROptions } from 'vite'
|
import type { InlineConfig, SSROptions } from 'vite'
|
||||||
import { logger, isIgnored } from '@nuxt/kit'
|
import { logger, isIgnored } from '@nuxt/kit'
|
||||||
import type { Options } from '@vitejs/plugin-vue'
|
import type { Options } from '@vitejs/plugin-vue'
|
||||||
|
import replace from '@rollup/plugin-replace'
|
||||||
import { sanitizeFilePath } from 'mlly'
|
import { sanitizeFilePath } from 'mlly'
|
||||||
import { getPort } from 'get-port-please'
|
import { getPort } from 'get-port-please'
|
||||||
import { buildClient } from './client'
|
import { buildClient } from './client'
|
||||||
@ -64,6 +65,10 @@ export async function bundle (nuxt: Nuxt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
replace({
|
||||||
|
...Object.fromEntries([';', '(', '{', '}', ' ', '\t', '\n'].map(d => [`${d}global.`, `${d}globalThis.`])),
|
||||||
|
preventAssignment: true
|
||||||
|
}),
|
||||||
virtual(nuxt.vfs),
|
virtual(nuxt.vfs),
|
||||||
DynamicBasePlugin.vite({ sourcemap: nuxt.options.sourcemap })
|
DynamicBasePlugin.vite({ sourcemap: nuxt.options.sourcemap })
|
||||||
],
|
],
|
||||||
|
@ -1628,6 +1628,7 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@nuxt/kit": ^3.0.0-rc.3
|
"@nuxt/kit": ^3.0.0-rc.3
|
||||||
"@nuxt/schema": ^3.0.0-rc.3
|
"@nuxt/schema": ^3.0.0-rc.3
|
||||||
|
"@rollup/plugin-replace": ^4.0.0
|
||||||
"@types/cssnano": ^5
|
"@types/cssnano": ^5
|
||||||
"@vitejs/plugin-vue": ^2.3.3
|
"@vitejs/plugin-vue": ^2.3.3
|
||||||
"@vitejs/plugin-vue-jsx": ^1.3.10
|
"@vitejs/plugin-vue-jsx": ^1.3.10
|
||||||
|
Loading…
Reference in New Issue
Block a user