uuidを生成する際、ブラウザ版のuuidが呼ばれてしまいエラーになっている。
vite.main.config.tsを以下のように変更すればrollupに巻き込まれない。
import { defineConfig } from "vite";
// https://vitejs.dev/config
export default defineConfig({
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
browserField: false,
mainFields: ["module", "jsnext:main", "jsnext"],
},
build: {
rollupOptions: {
external: [
"uuid"
],
},
},
});
たしかmongodbとかknexとかもelectronだとうまく動かなかった気がする。そういうやつらはexternalに入れておいてやるとなんとかなる。