mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Renames build.rollupOptions to build.rolldownOptions and optimizeDeps.esbuildOptions to optimizeDeps.rolldownOptions — both auto-convert in Vite 8 but are deprecated. Rewrites the d3v3 IIFE compat plugin for pre-bundling from esbuild's build.onLoad API to a Rolldown load hook. Replaces the vite-tsconfig-paths plugin with Vite 8's built-in resolve.tsconfigPaths. Adds css.lightningcss.errorRecovery since LightningCSS (now the default CSS minifier) chokes on pikaday's IE-era star property hacks.
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import { extensions, getViteAliases } from "./build-config.shared.js";
|
|
|
|
/**
|
|
* Vite plugin for Galaxy's legacy module resolution
|
|
*/
|
|
export function galaxyLegacyPlugin() {
|
|
return {
|
|
name: "vite-plugin-galaxy-legacy",
|
|
|
|
config: () => {
|
|
const aliases = getViteAliases();
|
|
|
|
return {
|
|
resolve: {
|
|
alias: aliases,
|
|
extensions,
|
|
},
|
|
|
|
optimizeDeps: {
|
|
// Pre-bundle problematic CommonJS dependencies
|
|
include: ["store", "jquery-migrate"],
|
|
|
|
// Fix CommonJS global references
|
|
rolldownOptions: {
|
|
define: {
|
|
global: "globalThis",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
},
|
|
|
|
// Custom resolver for edge cases
|
|
resolveId(id) {
|
|
// Special handling for popper.js
|
|
if (id === "popper.js") {
|
|
return { id: "popper.js/dist/esm/popper.js", external: false };
|
|
}
|
|
|
|
return null;
|
|
},
|
|
};
|
|
}
|