mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +00:00
fix: resolve chunksDirName based on outNames dirname (vercel)
This commit is contained in:
parent
1e34041e8d
commit
e16aee43ba
@ -1,5 +1,5 @@
|
|||||||
import Module from 'module'
|
import Module from 'module'
|
||||||
import { join, resolve } from 'path'
|
import { dirname, join, resolve } from 'path'
|
||||||
import { InputOptions, OutputOptions } from 'rollup'
|
import { InputOptions, OutputOptions } from 'rollup'
|
||||||
import { terser } from 'rollup-plugin-terser'
|
import { terser } from 'rollup-plugin-terser'
|
||||||
import commonjs from '@rollup/plugin-commonjs'
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
@ -88,12 +88,14 @@ export const getRollupConfig = (options: SLSOptions) => {
|
|||||||
external.push(...Module.builtinModules)
|
external.push(...Module.builtinModules)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const chunksDirName = join(dirname(options.outName), 'chunks')
|
||||||
|
|
||||||
const rollupConfig: RollupConfig = {
|
const rollupConfig: RollupConfig = {
|
||||||
input: resolvePath(options, options.entry),
|
input: resolvePath(options, options.entry),
|
||||||
output: {
|
output: {
|
||||||
dir: options.targetDir,
|
dir: options.targetDir,
|
||||||
entryFileNames: options.outName,
|
entryFileNames: options.outName,
|
||||||
chunkFileNames: 'chunks/_[name].js',
|
chunkFileNames: join(chunksDirName, '_[name].js'),
|
||||||
inlineDynamicImports: options.inlineChunks,
|
inlineDynamicImports: options.inlineChunks,
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
exports: 'auto',
|
exports: 'auto',
|
||||||
@ -129,7 +131,7 @@ export const getRollupConfig = (options: SLSOptions) => {
|
|||||||
rollupConfig.plugins.push(dynamicRequire({
|
rollupConfig.plugins.push(dynamicRequire({
|
||||||
dir: resolve(options.buildDir, 'dist/server'),
|
dir: resolve(options.buildDir, 'dist/server'),
|
||||||
inline: options.node === false || options.inlineChunks,
|
inline: options.node === false || options.inlineChunks,
|
||||||
outDir: join(options.targetDir, 'chunks'),
|
outDir: join(options.targetDir, chunksDirName),
|
||||||
prefix: './',
|
prefix: './',
|
||||||
globbyOptions: {
|
globbyOptions: {
|
||||||
ignore: [
|
ignore: [
|
||||||
|
Loading…
Reference in New Issue
Block a user