Skip to content

Commit

Permalink
feat: add invalid rollupOptions warnings (#14909)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Nov 8, 2023
1 parent b953b0d commit 7c240a0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,19 @@ export async function build(
`Please specify a dedicated SSR entry.`,
)
}
if (config.build.cssCodeSplit === false) {
const inputs =
typeof input === 'string'
? [input]
: Array.isArray(input)
? input
: Object.values(input)
if (inputs.some((input) => input.endsWith('.css'))) {
throw new Error(
`When "build.cssCodeSplit: false" is set, "rollupOptions.input" should not include CSS files.`,
)
}
}

const outDir = resolve(options.outDir)

Expand Down Expand Up @@ -552,6 +565,20 @@ export async function build(
`Please use "rollupOptions.output" instead.`,
)
}
if (output.file) {
throw new Error(
`Vite does not support "rollupOptions.output.file". ` +
`Please use "rollupOptions.output.dir" and "rollupOptions.output.entryFileNames" instead.`,
)
}
if (output.sourcemap) {
config.logger.warnOnce(
colors.yellow(
`Vite does not support "rollupOptions.output.sourcemap". ` +
`Please use "build.sourcemap" instead.`,
),
)
}

const ssrNodeBuild = ssr && config.ssr.target === 'node'
const ssrWorkerBuild = ssr && config.ssr.target === 'webworker'
Expand Down

0 comments on commit 7c240a0

Please sign in to comment.