mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat(schema): split dev/prod build directories (#28594)
This commit is contained in:
parent
0c9ba32c1e
commit
3ec103b1d4
@ -175,7 +175,29 @@ export default defineUntypedSchema({
|
||||
* ```
|
||||
*/
|
||||
buildDir: {
|
||||
$resolve: async (val: string | undefined, get): Promise<string> => resolve(await get('rootDir') as string, val || '.nuxt'),
|
||||
$resolve: async (val: string | undefined, get): Promise<string> => {
|
||||
const rootDir = await get('rootDir') as string
|
||||
|
||||
if (val) {
|
||||
return resolve(rootDir, val)
|
||||
}
|
||||
|
||||
const defaultBuildDir = resolve(rootDir, '.nuxt')
|
||||
|
||||
const isDev = await get('dev') as boolean
|
||||
if (isDev) {
|
||||
return defaultBuildDir
|
||||
}
|
||||
|
||||
// TODO: nuxi CLI should ensure .nuxt dir exists
|
||||
if (!existsSync(defaultBuildDir)) {
|
||||
// This is to ensure that types continue to work for CI builds
|
||||
return defaultBuildDir
|
||||
}
|
||||
|
||||
// TODO: handle build caching + using buildId in directory
|
||||
return resolve(rootDir, 'node_modules/.cache/nuxt/builds', 'production')
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
1
test/fixtures/basic-types/nuxt.config.ts
vendored
1
test/fixtures/basic-types/nuxt.config.ts
vendored
@ -9,7 +9,6 @@ export default defineNuxtConfig({
|
||||
future: {
|
||||
typescriptBundlerResolution: process.env.MODULE_RESOLUTION === 'bundler',
|
||||
},
|
||||
buildDir: process.env.NITRO_BUILD_DIR,
|
||||
builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite',
|
||||
theme: './extends/bar',
|
||||
extends: [
|
||||
|
2
test/fixtures/basic/nuxt.config.ts
vendored
2
test/fixtures/basic/nuxt.config.ts
vendored
@ -31,7 +31,6 @@ export default defineNuxtConfig({
|
||||
include: ['keepalive-in-config', 'not-keepalive-in-nuxtpage'],
|
||||
},
|
||||
},
|
||||
buildDir: process.env.NITRO_BUILD_DIR,
|
||||
builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite',
|
||||
appId: 'nuxt-app-basic',
|
||||
build: {
|
||||
@ -68,7 +67,6 @@ export default defineNuxtConfig({
|
||||
'/hydration/spa-redirection/**': { ssr: false },
|
||||
'/no-scripts': { experimentalNoScripts: true },
|
||||
},
|
||||
output: { dir: process.env.NITRO_OUTPUT_DIR },
|
||||
prerender: {
|
||||
routes: [
|
||||
'/random/a',
|
||||
|
@ -23,8 +23,6 @@ if (process.env.TEST_ENV !== 'built' && !isWindows) {
|
||||
setupTimeout: (isWindows ? 360 : 120) * 1000,
|
||||
nuxtConfig: {
|
||||
builder: isWebpack ? 'webpack' : 'vite',
|
||||
buildDir: process.env.NITRO_BUILD_DIR,
|
||||
nitro: { output: { dir: process.env.NITRO_OUTPUT_DIR } },
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -14,8 +14,6 @@ await setup({
|
||||
setupTimeout: (isWindows ? 360 : 120) * 1000,
|
||||
nuxtConfig: {
|
||||
builder: isWebpack ? 'webpack' : 'vite',
|
||||
buildDir: process.env.NITRO_BUILD_DIR,
|
||||
nitro: { output: { dir: process.env.NITRO_OUTPUT_DIR } },
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user