mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
feat: update preset options
external tracing enabled by default for node. this change is potentially breaking demo
This commit is contained in:
parent
eebdb2870a
commit
8a22fa333e
@ -10,7 +10,7 @@ import type { ServerMiddleware } from './server/middleware'
|
||||
|
||||
export interface NitroContext {
|
||||
timing: boolean
|
||||
inlineChunks: boolean
|
||||
inlineDynamicImports: boolean
|
||||
minify: boolean
|
||||
sourceMap: boolean
|
||||
externals: boolean | NodeExternalsOptions
|
||||
@ -62,18 +62,18 @@ export type NitroPreset = NitroInput | ((input: NitroInput) => NitroInput)
|
||||
|
||||
export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): NitroContext {
|
||||
const defaults: NitroContext = {
|
||||
timing: true,
|
||||
inlineChunks: true,
|
||||
minify: true,
|
||||
sourceMap: false,
|
||||
externals: false,
|
||||
analyze: false,
|
||||
timing: undefined,
|
||||
inlineDynamicImports: undefined,
|
||||
minify: undefined,
|
||||
sourceMap: undefined,
|
||||
externals: undefined,
|
||||
analyze: undefined,
|
||||
entry: undefined,
|
||||
node: undefined,
|
||||
preset: undefined,
|
||||
rollupConfig: undefined,
|
||||
renderer: undefined,
|
||||
serveStatic: false,
|
||||
serveStatic: undefined,
|
||||
middleware: [],
|
||||
scannedMiddleware: [],
|
||||
ignore: [],
|
||||
|
@ -6,7 +6,6 @@ import { writeFile } from '../utils'
|
||||
import { NitroPreset, NitroContext } from '../context'
|
||||
|
||||
export const azure: NitroPreset = {
|
||||
inlineChunks: false,
|
||||
entry: '{{ _internal.runtimeDir }}/entries/azure',
|
||||
output: {
|
||||
serverDir: '{{ output.dir }}/server/functions'
|
||||
|
@ -7,7 +7,6 @@ import { NitroPreset, NitroContext } from '../context'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const azure_functions: NitroPreset = {
|
||||
inlineChunks: false,
|
||||
serveStatic: true,
|
||||
entry: '{{ _internal.runtimeDir }}/entries/azure_functions',
|
||||
hooks: {
|
||||
|
@ -5,8 +5,6 @@ import { node } from './node'
|
||||
|
||||
export const cli: NitroPreset = extendPreset(node, {
|
||||
entry: '{{ _internal.runtimeDir }}/entries/cli',
|
||||
externals: true,
|
||||
inlineChunks: true,
|
||||
hooks: {
|
||||
'nitro:compiled' ({ output }: NitroContext) {
|
||||
consola.info('Run with `node ' + prettyPath(output.serverDir) + ' [route]`')
|
||||
|
@ -7,9 +7,7 @@ export const dev: NitroPreset = extendPreset(node, {
|
||||
output: {
|
||||
serverDir: '{{ _nuxt.buildDir }}/nitro'
|
||||
},
|
||||
minify: false,
|
||||
externals: { trace: false },
|
||||
inlineChunks: true,
|
||||
timing: false,
|
||||
inlineDynamicImports: true, // externals plugin limitation
|
||||
sourceMap: true
|
||||
})
|
||||
|
@ -7,7 +7,6 @@ import { writeFile } from '../utils'
|
||||
import { NitroPreset, NitroContext } from '../context'
|
||||
|
||||
export const firebase: NitroPreset = {
|
||||
inlineChunks: false,
|
||||
entry: '{{ _internal.runtimeDir }}/entries/firebase',
|
||||
hooks: {
|
||||
async 'nitro:compiled' (ctx: NitroContext) {
|
||||
|
@ -3,5 +3,5 @@ import { NitroPreset } from '../context'
|
||||
|
||||
export const lambda: NitroPreset = {
|
||||
entry: '{{ _internal.runtimeDir }}/entries/lambda',
|
||||
inlineChunks: false
|
||||
externals: true
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import { NitroPreset } from '../context'
|
||||
import { lambda } from './lambda'
|
||||
|
||||
export const netlify: NitroPreset = extendPreset(lambda, {
|
||||
// @ts-ignore
|
||||
output: {
|
||||
publicDir: '{{ _nuxt.rootDir }}/dist'
|
||||
},
|
||||
|
@ -2,5 +2,5 @@ import { NitroPreset } from '../context'
|
||||
|
||||
export const node: NitroPreset = {
|
||||
entry: '{{ _internal.runtimeDir }}/entries/node',
|
||||
inlineChunks: false
|
||||
externals: true
|
||||
}
|
||||
|
@ -5,10 +5,7 @@ import { node } from './node'
|
||||
|
||||
export const server: NitroPreset = extendPreset(node, {
|
||||
entry: '{{ _internal.runtimeDir }}/entries/server',
|
||||
externals: false,
|
||||
inlineChunks: false,
|
||||
serveStatic: true,
|
||||
minify: false,
|
||||
hooks: {
|
||||
'nitro:compiled' ({ output }: NitroContext) {
|
||||
consola.success('Ready to run', hl('node ' + prettyPath(output.serverDir)))
|
||||
|
@ -3,6 +3,8 @@ import { NitroPreset, NitroContext } from '../context'
|
||||
export const worker: NitroPreset = {
|
||||
entry: null, // Abstract
|
||||
node: false,
|
||||
minify: true,
|
||||
inlineDynamicImports: true, // iffe does not support code-splitting
|
||||
hooks: {
|
||||
'nitro:rollup:before' ({ rollupConfig }: NitroContext) {
|
||||
rollupConfig.output.format = 'iife'
|
||||
|
@ -84,7 +84,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
}
|
||||
return join('chunks', prefix, '[name].js')
|
||||
},
|
||||
inlineDynamicImports: nitroContext.inlineChunks,
|
||||
inlineDynamicImports: nitroContext.inlineDynamicImports,
|
||||
format: 'cjs',
|
||||
exports: 'auto',
|
||||
intro: '',
|
||||
@ -135,7 +135,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
// Dynamic Require Support
|
||||
rollupConfig.plugins.push(dynamicRequire({
|
||||
dir: resolve(nitroContext._nuxt.buildDir, 'dist/server'),
|
||||
inline: nitroContext.node === false || nitroContext.inlineChunks,
|
||||
inline: nitroContext.node === false || nitroContext.inlineDynamicImports,
|
||||
globbyOptions: {
|
||||
ignore: [
|
||||
'server.js'
|
||||
|
Loading…
Reference in New Issue
Block a user