Skip to content

Commit a3df44b

Browse files
committed
chore: use Rolldown options for the single-file Vite build
Vite 8 deprecates rollupOptions and inlineDynamicImports. codeSplitting: false keeps the one entry chunk the single-file plugin inlines.
1 parent b12dd18 commit a3df44b

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎vite.config.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Plugin, Rollup } from "vite";
1+
import type { Plugin, Rolldown } from "vite";
22
import { defineConfig } from "vite";
33
import { VitePWA } from "vite-plugin-pwa";
44
import packageJson from "./package.json" with { type: "json" };
@@ -64,7 +64,7 @@ function escapeRegExp(value: string): string {
6464
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6565
}
6666

67-
/** Decode a Rollup asset source (string or bytes) to text. */
67+
/** Decode a Rolldown asset source (string or bytes) to text. */
6868
function assetSourceToText(source: string | Uint8Array): string {
6969
return typeof source === "string" ? source : Buffer.from(source).toString("utf8");
7070
}
@@ -76,7 +76,7 @@ function assetSourceToText(source: string | Uint8Array): string {
7676
* The replacement is a function (never a string) so `$` sequences in the JS/CSS
7777
* are not interpreted as `String.prototype.replace` special patterns.
7878
*/
79-
function inlineAsset(html: string, fileName: string, item: Rollup.OutputChunk | Rollup.OutputAsset): string | null {
79+
function inlineAsset(html: string, fileName: string, item: Rolldown.OutputChunk | Rolldown.OutputAsset): string | null {
8080
const ref = escapeRegExp(fileName);
8181

8282
if (item.type === "chunk") {
@@ -130,7 +130,7 @@ function inlineSingleFile(): Plugin {
130130
return {
131131
name: "inline-single-file",
132132
enforce: "post",
133-
generateBundle(_options: Rollup.NormalizedOutputOptions, bundle: Rollup.OutputBundle): void {
133+
generateBundle(_options: Rolldown.NormalizedOutputOptions, bundle: Rolldown.OutputBundle): void {
134134
for (const htmlName of Object.keys(bundle)) {
135135
const htmlAsset = bundle[htmlName];
136136
if (!htmlName.endsWith(".html") || htmlAsset?.type !== "asset" || typeof htmlAsset.source !== "string") {
@@ -166,7 +166,7 @@ export default defineConfig(({ mode }) => {
166166
// So the build can be served from an arbitrary path
167167
base: "./",
168168
build: {
169-
// Requires Vite 8+ / esbuild ≥0.24. Run `npm ci` if build errors on ES2024.
169+
// Fleet browser target. Oxc accepts ES2024 directly.
170170
target: "es2024",
171171
// SceneryStack bundles exceed Vite's default 500 kB chunk warning.
172172
chunkSizeWarningLimit: 5000,
@@ -177,9 +177,9 @@ export default defineConfig(({ mode }) => {
177177
cssCodeSplit: false,
178178
// Skip copying public/ (favicon, icons) — nothing external should remain.
179179
copyPublicDir: false,
180-
rollupOptions: {
180+
rolldownOptions: {
181181
// Collapse dynamic imports into the single entry chunk.
182-
output: { inlineDynamicImports: true },
182+
output: { codeSplitting: false },
183183
},
184184
}),
185185
},

0 commit comments

Comments
 (0)