2022-05-27 15:37:02 +00:00
|
|
|
import viteBaseConfig from "../vite.config";
|
2022-05-06 15:56:26 +00:00
|
|
|
|
2022-03-31 08:45:47 +00:00
|
|
|
const path = require("path");
|
|
|
|
const { defineConfig } = require("vite");
|
2022-05-27 15:37:02 +00:00
|
|
|
|
2022-05-06 15:56:26 +00:00
|
|
|
module.exports = defineConfig((configEnv) => {
|
|
|
|
const config = {
|
2022-05-27 15:37:02 +00:00
|
|
|
...viteBaseConfig,
|
2022-05-06 15:56:26 +00:00
|
|
|
base: "/embed/",
|
|
|
|
build: {
|
|
|
|
minify: "terser",
|
|
|
|
terserOptions: {
|
|
|
|
format: {
|
|
|
|
comments: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
|
|
|
preview: path.resolve(__dirname, "preview.html"),
|
|
|
|
embed: path.resolve(__dirname, "src/embed.ts"),
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
entryFileNames: "[name].js",
|
|
|
|
//FIXME: Can't specify UMD as import because preview is an app which doesn't support `format` and this setting apply to both input
|
|
|
|
//format: "umd",
|
|
|
|
dir: "../../../apps/web/public/embed",
|
|
|
|
},
|
2022-04-08 05:33:24 +00:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 15:56:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (configEnv.mode === "development") {
|
|
|
|
config.build.watch = {
|
|
|
|
include: ["src/**"],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return config;
|
2022-03-31 08:45:47 +00:00
|
|
|
});
|