New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(vite,webpack): tree-shakable import.meta.*
build flags
#22428
Conversation
Co-authored-by: Lucas Vargas <vargasmesh@users.noreply.github.com>
Co-authored-by: Lucas Vargas <vargasmesh@users.noreply.github.com>
Run & review this pull request in StackBlitz Codeflow. |
β Live Preview ready!
|
import.meta
build flags
import.meta
build flags@@ -15,6 +15,7 @@ | |||
// Workaround for stub mode | |||
// https://github.com/nuxt/framework/pull/3983 | |||
process.server = true | |||
import.meta.server = true |
Check notice
Code scanning / CodeQL
Syntax error Note
.then(r => r.default(process.server ? url : window.location.href))) | ||
const url = import.meta.server ? nuxtApp.ssrContext.url : window.location.pathname | ||
const SingleRenderer = import.meta.test && import.meta.dev && import.meta.server && url.startsWith('/__nuxt_component_test__/') && /* #__PURE__ */ defineAsyncComponent(() => import('#build/test-component-wrapper.mjs') | ||
.then(r => r.default(import.meta.server ? url : window.location.href))) |
Check warning
Code scanning / CodeQL
Client-side cross-site scripting (experimental) Medium Experimental
a user-provided value
import.meta.*
build flags
π Linked issue
Resolves #21862
β Type of change
π Description
Introduce:
import.meta.browser
and replaceprocess.browser
import.meta.client
and replaceprocess.client
import.meta.server
and replaceprocess.server
import.meta.dev
and replaceprocess.dev
import.meta.test
and replaceprocess.test
Remove unused flags:
Define
NuxtStaticBuildFlags
:Note that this also bumps the webpack server target to
es2020
to be in line with vite's default target, and also to supportimport.meta.url
on the server.π Checklist