ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 31 forks source link

vite.js doesn't work anymore #594

Closed Rdornier closed 1 month ago

Rdornier commented 1 month ago

Hi @will-moore ,

I get an unexpected error while I was developping on figure. I pulled the last commits from the main repo and i wasn't able anymore to make vite running.

Doing a npm start starts the engin but the page localhost:8080 sends an error

Uncaught SyntaxError: redeclaration of import __vite__injectQuery note: Previously declared at line 1, column 25 [chunk-DPGIJH5W.js:1:25](http://localhost:8080/@fs/D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/.vite/deps/chunk-DPGIJH5W.js?v=80d5f3de) [chunk-DPGIJH5W.js:55523:10](http://localhost:8080/@fs/D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/.vite/deps/chunk-DPGIJH5W.js?v=80d5f3de)

I also tried to do a npm run build but I get this error

✓ 162 modules transformed.
x Build failed in 12.09s
error during build:
[vite]: Rollup failed to resolve import "fsevents" from "D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65532:17)
    at onRollupWarning (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65564:5)
    at onwarn (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65227:7)
    at file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js:18686:13
    at Object.logger [as onLog] (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js:20325:9)
    at ModuleLoader.handleInvalidResolvedId (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js:19275:26)
    at ModuleLoader.resolveDynamicImport (file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js:19333:58)
    at async file:///D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js:19221:32

preceded by a lot of warnings like

[plugin:vite:resolve] [plugin vite:resolve] Module "node:perf_hooks" has been externalized for browser compatibility, imported by "D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "node:fs/promises" has been externalized for browser compatibility, imported by "D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "tty" has been externalized for browser compatibility, imported by "D:/Remy/Github-projects/docker-omero-web/omero-figure/node_modules/rollup/dist/es/shared/node-entry.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

Did you also have this kind of issues ? I don't really know how to solve this and it's annoying as I cannot test my code anymore.

Thanks, Rémy.

will-moore commented 1 month ago

Seems others have similar issue - e.g. https://stackoverflow.com/questions/75904474/how-to-resolve-error-cannot-find-module-fsevents-when-using-vite-on-windows

Rdornier commented 1 month ago

Hi will,

Indeed, there were a import { rollupVersion } from "vite"; somewhere which breaks everything. I was focused on the error given by the npm start command but it wasn't fruitful.

Thanks for fast debugging !