mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
Switch from vite to rolldown-vite for improved build performance (#9523)
* Switch from vite to rolldown-vite for improved build performance - Add vite resolution to npm:rolldown-vite@latest in package.json - rolldown-vite is a drop-in replacement that uses Rust-based Rolldown bundler - Expected benefits: 3x-16x faster builds, up to 100x less memory usage - No configuration changes needed - rolldown-vite maintains full compatibility * Switch minifier from terser to oxc - Change minify option from 'terser' to 'oxc' in vite.config.ts - Remove terserOptions since they're not needed with oxc minifier - Fix ESLint error by prefixing unused catch variable with underscore - Oxc is the high-performance Rust-based minifier used by rolldown-vite - Expected benefits: faster minification with better performance * Fix TypeScript compatibility issues with rolldown-vite - Add type assertion for minify: 'oxc' option which is supported by rolldown-vite but not in standard Vite types - Update comment for webpackStats plugin to reflect rolldown-vite compatibility - Resolves TypeScript compilation errors in CI * fix * pin * node-20 * Node 22 support * Use oxc variant of react plugin * tsc * fix: Remove node 21 from engines It has problematic CJS behavior that was fixed in 22 --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com>
This commit is contained in:
+5
-46
@@ -1,6 +1,6 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import react from "@vitejs/plugin-react-oxc";
|
||||
import browserslistToEsbuild from "browserslist-to-esbuild";
|
||||
import webpackStats from "rollup-plugin-webpack-stats";
|
||||
import { ServerOptions, defineConfig } from "vite";
|
||||
@@ -19,7 +19,7 @@ if (environment.NODE_ENV === "development") {
|
||||
key: fs.readFileSync("./server/config/certs/private.key"),
|
||||
cert: fs.readFileSync("./server/config/certs/public.cert"),
|
||||
};
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("No local SSL certs found, HTTPS will not be available");
|
||||
}
|
||||
@@ -45,35 +45,7 @@ export default () =>
|
||||
: { strict: true },
|
||||
},
|
||||
plugins: [
|
||||
// https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme
|
||||
react({
|
||||
babel: {
|
||||
env: {
|
||||
production: {
|
||||
plugins: [
|
||||
[
|
||||
"babel-plugin-styled-components",
|
||||
{
|
||||
displayName: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
"babel-plugin-styled-components",
|
||||
{
|
||||
displayName: true,
|
||||
fileName: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
parserOpts: {
|
||||
plugins: ["decorators-legacy", "classProperties"],
|
||||
},
|
||||
},
|
||||
}),
|
||||
react(),
|
||||
// https://github.com/sapphi-red/vite-plugin-static-copy#readme
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
@@ -176,17 +148,8 @@ export default () =>
|
||||
},
|
||||
}),
|
||||
// Generate a stats.json file for webpack that will be consumed by RelativeCI
|
||||
// @ts-expect-error Type mismatch with latest versions but Plugin runs without issue
|
||||
webpackStats(),
|
||||
],
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
keepNames: true,
|
||||
define: {
|
||||
global: "globalThis",
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"~": path.resolve(__dirname, "./app"),
|
||||
@@ -197,15 +160,11 @@ export default () =>
|
||||
outDir: "./build/app",
|
||||
manifest: true,
|
||||
sourcemap: process.env.CI ? false : "hidden",
|
||||
minify: "terser",
|
||||
// Prevent asset inling as it does not conform to CSP rules
|
||||
minify: "oxc",
|
||||
// Prevent asset inlining as it does not conform to CSP rules
|
||||
assetsInlineLimit: 0,
|
||||
target: browserslistToEsbuild(),
|
||||
reportCompressedSize: false,
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
rollupOptions: {
|
||||
onwarn(warning, warn) {
|
||||
// Suppress noisy warnings about module-level directives, e.g. "use client"
|
||||
|
||||
Reference in New Issue
Block a user