This repository has been archived on 2024-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
share2fedi/vite.config.js
2023-09-02 21:56:42 +02:00

25 lines
635 B
JavaScript

import legacy from "@vitejs/plugin-legacy";
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
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, ViteImageOptimizer({})],
};