perf(nuxt): import defineNuxtConfig from nuxt/config (#7485)

This commit is contained in:
pooya parsa 2022-09-14 12:37:30 +02:00 committed by GitHub
parent 5d79ed5f9e
commit 3a60bf69ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 3 deletions

7
packages/nuxt/config.cjs Normal file
View File

@ -0,0 +1,7 @@
function defineNuxtConfig (config) {
return config
}
module.exports = {
defineNuxtConfig
}

4
packages/nuxt/config.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { NuxtConfig } from '@nuxt/schema'
export { NuxtConfig } from '@nuxt/schema'
export declare function defineNuxtConfig(config: NuxtConfig): NuxtConfig

5
packages/nuxt/config.mjs Normal file
View File

@ -0,0 +1,5 @@
function defineNuxtConfig (config) {
return config
}
export { defineNuxtConfig }

View File

@ -12,6 +12,11 @@
}, },
"exports": { "exports": {
".": "./dist/index.mjs", ".": "./dist/index.mjs",
"./config": {
"import": "./config.mjs",
"require": "./config.cjs",
"types": "./config.d.ts"
},
"./app": "./dist/app/index.mjs", "./app": "./dist/app/index.mjs",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
@ -24,7 +29,8 @@
"app.d.ts", "app.d.ts",
"bin", "bin",
"types.d.ts", "types.d.ts",
"dist" "dist",
"config.*"
], ],
"scripts": { "scripts": {
"prepack": "unbuild" "prepack": "unbuild"

View File

@ -234,9 +234,10 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
return nuxt return nuxt
} }
/** @deprecated Use import { defineNuxtConfig } from 'nuxt/config' */
export function defineNuxtConfig (config: NuxtConfig): NuxtConfig { export function defineNuxtConfig (config: NuxtConfig): NuxtConfig {
return config return config
} }
// For a convenience import together with `defineNuxtConfig` /** @deprecated Use import type { NuxtConfig } from 'nuxt/config' */
export type { NuxtConfig } export type { NuxtConfig }

View File

@ -1,3 +1,3 @@
import { defineNuxtConfig } from 'nuxt' import { defineNuxtConfig } from 'nuxt/config'
export default defineNuxtConfig({}) export default defineNuxtConfig({})