1
0
mirror of https://github.com/NickKaramoff/toot synced 2025-01-31 01:27:28 +01:00
Nikita Karamov c53384a54d
Fix Vite config
Node plugin would also work on build which messes up the `root` config
entry. This should fix the deploy not working.
2023-09-02 21:56:39 +02:00

25 lines
545 B
JavaScript

import legacy from "@vitejs/plugin-legacy";
import { VitePluginNode } from "vite-plugin-node";
const vitePluginNode = VitePluginNode({
// Workaround from: https://github.com/axe-me/vite-plugin-node/issues/47
adapter({ app, req, res, next }) {
if (req.url.startsWith("/api/")) {
app(req, res);
} else {
next();
}
},
appPath: "./api/share.js",
});
vitePluginNode[0].apply = "serve";
export default {
build: {
minify: "terser",
terserOptions: { ecma: 5 },
sourcemap: "true",
},
plugins: [legacy(), ...vitePluginNode],
};