mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
refactor: rename static
to public
(#284)
This commit is contained in:
parent
1370dd6719
commit
04c3f65539
@ -380,10 +380,16 @@ export default {
|
||||
/** The directory which will be processed to auto-generate your application page routes. */
|
||||
pages: 'pages',
|
||||
/**
|
||||
* Your static directory, which will be directly accessible via the Nuxt server and copied
|
||||
* across into your `dist` folder when your app is generated.
|
||||
* The directory containing your static files, which will be directly accessible via the Nuxt server
|
||||
* and copied across into your `dist` folder when your app is generated.
|
||||
*/
|
||||
static: 'static',
|
||||
public: {
|
||||
$resolve: (val, get) => val || get('dir.static') || 'public',
|
||||
},
|
||||
static: {
|
||||
$schema: { deprecated: 'use `dir.public` option instead' },
|
||||
$resolve: (val, get) => val || get('dir.public') || 'public',
|
||||
},
|
||||
/** The folder which will be used to auto-generate your Vuex store structure. */
|
||||
store: 'store'
|
||||
},
|
||||
|
@ -35,9 +35,9 @@ export async function generate (nitroContext: NitroContext) {
|
||||
await copy(clientDist, join(nitroContext.output.publicDir, nitroContext._nuxt.publicPath))
|
||||
}
|
||||
|
||||
const staticDir = resolve(nitroContext._nuxt.srcDir, nitroContext._nuxt.staticDir)
|
||||
if (await isDirectory(staticDir)) {
|
||||
await copy(staticDir, nitroContext.output.publicDir)
|
||||
const publicDir = nitroContext._nuxt.publicDir
|
||||
if (await isDirectory(publicDir)) {
|
||||
await copy(publicDir, nitroContext.output.publicDir)
|
||||
}
|
||||
|
||||
consola.success('Generated public ' + prettyPath(nitroContext.output.publicDir))
|
||||
|
@ -43,7 +43,7 @@ export interface NitroContext {
|
||||
srcDir: string
|
||||
buildDir: string
|
||||
generateDir: string
|
||||
staticDir: string
|
||||
publicDir: string
|
||||
serverDir: string
|
||||
routerBase: string
|
||||
publicPath: string
|
||||
@ -101,7 +101,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
|
||||
srcDir: nuxtOptions.srcDir,
|
||||
buildDir: nuxtOptions.buildDir,
|
||||
generateDir: nuxtOptions.generate.dir,
|
||||
staticDir: nuxtOptions.dir.static,
|
||||
publicDir: resolve(nuxtOptions.srcDir, nuxtOptions.dir.public || nuxtOptions.dir.static),
|
||||
serverDir: resolve(nuxtOptions.srcDir, (nuxtOptions.dir as any).server || 'server'),
|
||||
routerBase: nuxtOptions.router.base,
|
||||
publicPath: nuxtOptions.build.publicPath,
|
||||
@ -154,7 +154,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
|
||||
|
||||
// Assets
|
||||
nitroContext.assets.dirs.server = {
|
||||
dir: resolve(nitroContext._nuxt.rootDir, 'server/assets'), meta: true
|
||||
dir: resolve(nitroContext._nuxt.srcDir, 'server/assets'), meta: true
|
||||
}
|
||||
|
||||
// console.log(nitroContext)
|
||||
|
@ -8,7 +8,7 @@ export const vercel: NitroPreset = extendPreset(node, {
|
||||
output: {
|
||||
dir: '{{ _nuxt.rootDir }}/.vercel_build_output',
|
||||
serverDir: '{{ output.dir }}/functions/node/server',
|
||||
publicDir: '{{ output.dir }}/static'
|
||||
publicDir: '{{ output.dir }}/public'
|
||||
},
|
||||
ignore: [
|
||||
'vercel.json'
|
||||
|
@ -54,7 +54,7 @@ export function createDevServer (nitroContext: NitroContext) {
|
||||
|
||||
// _nuxt and static
|
||||
app.use(nitroContext._nuxt.publicPath, serveStatic(resolve(nitroContext._nuxt.buildDir, 'dist/client')))
|
||||
app.use(nitroContext._nuxt.routerBase, serveStatic(resolve(nitroContext._nuxt.staticDir)))
|
||||
app.use(nitroContext._nuxt.routerBase, serveStatic(resolve(nitroContext._nuxt.publicDir)))
|
||||
|
||||
// Dynamic Middlwware
|
||||
const legacyMiddleware = createDynamicMiddleware()
|
||||
|
Loading…
Reference in New Issue
Block a user