calcom/packages/embeds/embed-core/vite.config.js
Hariom Balhara 67cc3a6409
Embed Code Generator: Fix Preview HTML and Embed Lib path for production (#2688)
* Improve logging

* Improve logging

* Keep embed origin conigurable

* Make embed URL and embed origin conigurable through env

* Gitignore public embed

* Add fingerprint to preview as well

* Fix path

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-05-06 15:56:26 +00:00

39 lines
1 KiB
JavaScript

require("dotenv").config({ path: "../../../.env" });
process.env.NEXT_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
const path = require("path");
const { defineConfig } = require("vite");
module.exports = defineConfig((configEnv) => {
const config = {
envPrefix: "NEXT_PUBLIC_",
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",
},
},
},
};
if (configEnv.mode === "development") {
config.build.watch = {
include: ["src/**"],
};
}
return config;
});