mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-21 16:55:57 +00:00
fix(nuxt): use new mocked-exports
(#31295)
This commit is contained in:
parent
c3352e80b1
commit
d09c8ec71f
@ -106,6 +106,7 @@
|
|||||||
"knitwork": "^1.2.0",
|
"knitwork": "^1.2.0",
|
||||||
"magic-string": "^0.30.17",
|
"magic-string": "^0.30.17",
|
||||||
"mlly": "^1.7.4",
|
"mlly": "^1.7.4",
|
||||||
|
"mocked-exports": "^0.1.0",
|
||||||
"nanotar": "^0.2.0",
|
"nanotar": "^0.2.0",
|
||||||
"nitropack": "^2.11.5",
|
"nitropack": "^2.11.5",
|
||||||
"nypm": "^0.6.0",
|
"nypm": "^0.6.0",
|
||||||
@ -126,7 +127,6 @@
|
|||||||
"ultrahtml": "^1.5.3",
|
"ultrahtml": "^1.5.3",
|
||||||
"uncrypto": "^0.1.3",
|
"uncrypto": "^0.1.3",
|
||||||
"unctx": "^2.4.1",
|
"unctx": "^2.4.1",
|
||||||
"unenv": "^2.0.0-rc.12",
|
|
||||||
"unimport": "^4.1.2",
|
"unimport": "^4.1.2",
|
||||||
"unplugin": "^2.2.0",
|
"unplugin": "^2.2.0",
|
||||||
"unplugin-vue-router": "^0.12.0",
|
"unplugin-vue-router": "^0.12.0",
|
||||||
|
@ -14,6 +14,7 @@ import { isWindows } from 'std-env'
|
|||||||
import { ImpoundPlugin } from 'impound'
|
import { ImpoundPlugin } from 'impound'
|
||||||
import type { Nuxt, NuxtOptions } from 'nuxt/schema'
|
import type { Nuxt, NuxtOptions } from 'nuxt/schema'
|
||||||
import { resolveModulePath } from 'exsolve'
|
import { resolveModulePath } from 'exsolve'
|
||||||
|
|
||||||
import { version as nuxtVersion } from '../../package.json'
|
import { version as nuxtVersion } from '../../package.json'
|
||||||
import { distDir } from '../dirs'
|
import { distDir } from '../dirs'
|
||||||
import { toArray } from '../utils'
|
import { toArray } from '../utils'
|
||||||
@ -63,7 +64,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mockProxy = resolveModulePath('unenv/mock/proxy', { from: import.meta.url })
|
const mockProxy = resolveModulePath('mocked-exports/proxy', { from: import.meta.url })
|
||||||
|
|
||||||
const nitroConfig: NitroConfig = defu(nuxt.options.nitro, {
|
const nitroConfig: NitroConfig = defu(nuxt.options.nitro, {
|
||||||
debug: nuxt.options.debug ? nuxt.options.debug.nitro : false,
|
debug: nuxt.options.debug ? nuxt.options.debug.nitro : false,
|
||||||
|
@ -872,6 +872,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
|
|||||||
options.modulesDir.push(resolve(options.workspaceDir, 'node_modules'))
|
options.modulesDir.push(resolve(options.workspaceDir, 'node_modules'))
|
||||||
options.modulesDir.push(resolve(pkgDir, 'node_modules'))
|
options.modulesDir.push(resolve(pkgDir, 'node_modules'))
|
||||||
options.build.transpile.push(
|
options.build.transpile.push(
|
||||||
|
'mocked-exports',
|
||||||
'std-env', // we need to statically replace process.env when used in runtime code
|
'std-env', // we need to statically replace process.env when used in runtime code
|
||||||
)
|
)
|
||||||
options.alias['vue-demi'] = resolve(options.appDir, 'compat/vue-demi')
|
options.alias['vue-demi'] = resolve(options.appDir, 'compat/vue-demi')
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
"magic-string": "^0.30.17",
|
"magic-string": "^0.30.17",
|
||||||
"mlly": "^1.7.4",
|
"mlly": "^1.7.4",
|
||||||
"ohash": "^2.0.11",
|
"ohash": "^2.0.11",
|
||||||
|
"mocked-exports": "^0.1.0",
|
||||||
"pathe": "^2.0.3",
|
"pathe": "^2.0.3",
|
||||||
"perfect-debounce": "^1.0.0",
|
"perfect-debounce": "^1.0.0",
|
||||||
"pkg-types": "^2.1.0",
|
"pkg-types": "^2.1.0",
|
||||||
|
@ -12,6 +12,7 @@ import { defineEnv } from 'unenv'
|
|||||||
import { resolveModulePath } from 'exsolve'
|
import { resolveModulePath } from 'exsolve'
|
||||||
import { defineEventHandler, handleCors, setHeader } from 'h3'
|
import { defineEventHandler, handleCors, setHeader } from 'h3'
|
||||||
import type { ViteConfig } from '@nuxt/schema'
|
import type { ViteConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
import type { ViteBuildContext } from './vite'
|
import type { ViteBuildContext } from './vite'
|
||||||
import { DevStyleSSRPlugin } from './plugins/dev-ssr-css'
|
import { DevStyleSSRPlugin } from './plugins/dev-ssr-css'
|
||||||
import { RuntimePathsPlugin } from './plugins/paths'
|
import { RuntimePathsPlugin } from './plugins/paths'
|
||||||
@ -120,7 +121,7 @@ export async function buildClient (ctx: ViteBuildContext) {
|
|||||||
...ctx.config.resolve?.alias,
|
...ctx.config.resolve?.alias,
|
||||||
'#internal/nitro': join(ctx.nuxt.options.buildDir, 'nitro.client.mjs'),
|
'#internal/nitro': join(ctx.nuxt.options.buildDir, 'nitro.client.mjs'),
|
||||||
// work around vite optimizer bug
|
// work around vite optimizer bug
|
||||||
'#app-manifest': resolveModulePath('unenv/mock/empty', { from: import.meta.url }),
|
'#app-manifest': resolveModulePath('mocked-exports/empty', { from: import.meta.url }),
|
||||||
},
|
},
|
||||||
dedupe: [
|
dedupe: [
|
||||||
'vue',
|
'vue',
|
||||||
|
@ -10,6 +10,7 @@ import { withoutLeadingSlash } from 'ufo'
|
|||||||
import { filename } from 'pathe/utils'
|
import { filename } from 'pathe/utils'
|
||||||
import { resolveModulePath } from 'exsolve'
|
import { resolveModulePath } from 'exsolve'
|
||||||
import { resolveTSConfig } from 'pkg-types'
|
import { resolveTSConfig } from 'pkg-types'
|
||||||
|
import { resolveModulePath } from 'exsolve'
|
||||||
|
|
||||||
import { buildClient } from './client'
|
import { buildClient } from './client'
|
||||||
import { buildServer } from './server'
|
import { buildServer } from './server'
|
||||||
@ -55,9 +56,10 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
|
|||||||
|
|
||||||
const { $client, $server, ...viteConfig } = nuxt.options.vite
|
const { $client, $server, ...viteConfig } = nuxt.options.vite
|
||||||
|
|
||||||
|
const mockEmpty = resolveModulePath('mocked-exports/empty', { from: import.meta.url })
|
||||||
|
|
||||||
const isIgnored = createIsIgnored(nuxt)
|
const isIgnored = createIsIgnored(nuxt)
|
||||||
|
|
||||||
const mockEmpty = resolveModulePath('unenv/mock/empty', { from: import.meta.url })
|
|
||||||
const ctx: ViteBuildContext = {
|
const ctx: ViteBuildContext = {
|
||||||
nuxt,
|
nuxt,
|
||||||
entry,
|
entry,
|
||||||
|
@ -429,6 +429,9 @@ importers:
|
|||||||
mlly:
|
mlly:
|
||||||
specifier: ^1.7.4
|
specifier: ^1.7.4
|
||||||
version: 1.7.4
|
version: 1.7.4
|
||||||
|
mocked-exports:
|
||||||
|
specifier: ^0.1.0
|
||||||
|
version: 0.1.0
|
||||||
nanotar:
|
nanotar:
|
||||||
specifier: ^0.2.0
|
specifier: ^0.2.0
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
@ -489,9 +492,6 @@ importers:
|
|||||||
unctx:
|
unctx:
|
||||||
specifier: ^2.4.1
|
specifier: ^2.4.1
|
||||||
version: 2.4.1
|
version: 2.4.1
|
||||||
unenv:
|
|
||||||
specifier: ^2.0.0-rc.12
|
|
||||||
version: 2.0.0-rc.12
|
|
||||||
unimport:
|
unimport:
|
||||||
specifier: 4.1.2
|
specifier: 4.1.2
|
||||||
version: 4.1.2
|
version: 4.1.2
|
||||||
@ -927,6 +927,9 @@ importers:
|
|||||||
mlly:
|
mlly:
|
||||||
specifier: ^1.7.4
|
specifier: ^1.7.4
|
||||||
version: 1.7.4
|
version: 1.7.4
|
||||||
|
mocked-exports:
|
||||||
|
specifier: ^0.1.0
|
||||||
|
version: 0.1.0
|
||||||
ohash:
|
ohash:
|
||||||
specifier: ^2.0.11
|
specifier: ^2.0.11
|
||||||
version: 2.0.11
|
version: 2.0.11
|
||||||
@ -5754,6 +5757,9 @@ packages:
|
|||||||
mlly@1.7.4:
|
mlly@1.7.4:
|
||||||
resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==}
|
resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==}
|
||||||
|
|
||||||
|
mocked-exports@0.1.0:
|
||||||
|
resolution: {integrity: sha512-sD6J0bqR2L9OPz0Tmkb2iVFTft8u1VigiAb5vKC9wVk5Fmp70wkpnOYHIww4icXD5mn/kGW7q/kQN3VEOPL8QQ==}
|
||||||
|
|
||||||
mri@1.2.0:
|
mri@1.2.0:
|
||||||
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
|
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@ -13209,6 +13215,8 @@ snapshots:
|
|||||||
pkg-types: 1.3.1
|
pkg-types: 1.3.1
|
||||||
ufo: 1.5.4
|
ufo: 1.5.4
|
||||||
|
|
||||||
|
mocked-exports@0.1.0: {}
|
||||||
|
|
||||||
mri@1.2.0: {}
|
mri@1.2.0: {}
|
||||||
|
|
||||||
mrmime@2.0.0: {}
|
mrmime@2.0.0: {}
|
||||||
|
Loading…
Reference in New Issue
Block a user