Frontend: Vite 8 (Rolldown)
vite 7.3.8 -> 8.3.8. @vitejs/plugin-react-swc 4.3.3 already accepts Vite 8 and vite-plugin-svgr 4.5.0 / vite-tsconfig-paths 6.1.1 accept any Vite, so no plugin major is needed; vite.config.ts uses no option Vite 8 removed or renamed. One source change: Vite 8 resolves a default import from CommonJS the way Node does when the importing package is "type": "module" - it is module.exports, not exports.default. react-plotly.js/factory is Babel-compiled CommonJS, so the factory is now taken as .default of the import; without that the app stopped at start-up with "(0, x.default) is not a function". vite build drops from ~24 s to ~1.5 s; dist/ shrinks from 6.11 MB to 5.91 MB (index 3097 -> 2970 kB, RugnuxStructureViewer 2922 -> 2845 kB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
1 parent
eb0b1fd606
commit
0deaccf53d
3 files changed
+725
-43
No files matched your search
Generated
+720
-40
File diff suppressed because it is too large.
Load diff
@@ -27,7 +27,7 @@
|
||||
"react-zoom-pan-pinch": "^3.4.3",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
||||
"vite": "^7.3.8",
|
||||
"vite": "^8.3.8",
|
||||
"vite-plugin-svgr": "^4.5.0",
|
||||
"vite-tsconfig-paths": "^6.1.1",
|
||||
"zod": "^4.6.7"
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
// Not using TypeScript, as plotly is not TypeScript :(
|
||||
|
||||
import {useEffect, useRef} from "react";
|
||||
import createPlotlyComponent from "react-plotly.js/factory";
|
||||
import reactPlotlyFactory from "react-plotly.js/factory";
|
||||
import Plotly from "plotly.js-cartesian-dist-min";
|
||||
|
||||
const PlotlyPlot = createPlotlyComponent(Plotly);
|
||||
// react-plotly.js is CommonJS (exports.default); in a "type": "module" package Vite 8 gives the default
|
||||
// import as its module.exports, as Node does, so the factory is the .default of that.
|
||||
const PlotlyPlot = reactPlotlyFactory.default(Plotly);
|
||||
|
||||
// Plotly's `responsive` config follows the window only; a plot's own box also changes when the
|
||||
// drawer opens or closes, so the plot is redrawn to its box whenever that resizes.
|
||||
|
||||
Reference in new issue
Block a user