tweak target defaults to disable minify and inlining for non workers

This commit is contained in:
Pooya Parsa 2020-11-14 01:23:22 +01:00
parent a5e70eb4b0
commit 3d2c019a6a
6 changed files with 5 additions and 5 deletions

View File

@ -71,6 +71,7 @@ export function getoptions (nuxtOptions: Nuxt['options'], serverless: SLSConfig)
outName: '_nuxt.js',
logStartup: true,
inlineChunks: true,
minify: false,
runtimeDir: resolve(__dirname, '../runtime'),
slsDir: '{{ rootDir }}/.nuxt/serverless',

View File

@ -74,10 +74,7 @@ export default <Module> function slsModule () {
nuxt.hook('generate:before', async () => {
const { entry } = await build(getoptions(nuxt.options, {
target: 'node',
serverMiddleware: options.serverMiddleware,
node: true,
minify: false,
analyze: false
serverMiddleware: options.serverMiddleware
}))
require(entry)
})

View File

@ -6,6 +6,7 @@ import { SLSTarget } from '../config'
export const lambda: SLSTarget = {
entry: '{{ runtimeDir }}/targets/lambda',
outName: '_nuxt.js',
inlineChunks: false,
hooks: {
'done' ({ rollupConfig }) {
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')

View File

@ -5,6 +5,7 @@ import { SLSTarget } from '../config'
export const node: SLSTarget = {
entry: '{{ runtimeDir }}/targets/node',
outName: 'index.js',
inlineChunks: false,
hooks: {
'done' ({ rollupConfig }) {
const entry = relative(process.cwd(), rollupConfig.output.file)

View File

@ -7,7 +7,6 @@ export const vercel: SLSTarget = extendTarget(node, {
targetDir: '{{ rootDir }}/.vercel_build_output',
outName: 'functions/node/_nuxt/index.js',
publicDir: '{{ targetDir }}/static',
inlineChunks: false,
generateIgnore: [
'vercel.json'
],

View File

@ -13,6 +13,7 @@ global.process = global.process || {};
export const worker: SLSTarget = {
entry: null, // Abstract
node: false,
minify: true,
hooks: {
'rollup:before' ({ rollupConfig }) {
rollupConfig.output.intro = polyfill + rollupConfig.output.intro