2022-02-10 15:26:11 -05:00
|
|
|
import { defineConfig } from "vite";
|
2022-02-10 16:21:09 -05:00
|
|
|
import * as path from "node:path";
|
2022-02-10 16:20:53 -05:00
|
|
|
import package_ from "./package.json";
|
2022-02-10 15:26:11 -05:00
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
build: {
|
|
|
|
lib: {
|
|
|
|
entry: path.resolve("./src/index.js"),
|
|
|
|
name: "Shareon",
|
|
|
|
formats: ["es", "umd", "iife"],
|
2023-01-25 12:19:33 -05:00
|
|
|
// Workaround to keep the old file names
|
|
|
|
fileName: (format, _) => `shareon.${format}.js`,
|
2022-02-10 15:26:11 -05:00
|
|
|
},
|
2022-02-10 15:44:35 -05:00
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
2023-01-25 12:27:00 -05:00
|
|
|
// Workaround for a correct file name
|
|
|
|
// See: https://github.com/vitejs/vite/issues/4863
|
|
|
|
assetFileNames: (assetInfo) => {
|
|
|
|
if (assetInfo.name === "style.css") return "shareon.min.css";
|
|
|
|
return assetInfo.name;
|
|
|
|
},
|
2022-02-10 16:20:53 -05:00
|
|
|
banner: `/*! ${package_.name} v${package_.version} */`,
|
2022-02-10 15:44:35 -05:00
|
|
|
},
|
|
|
|
},
|
2022-02-10 15:26:11 -05:00
|
|
|
},
|
2023-01-25 12:27:20 -05:00
|
|
|
css: {
|
|
|
|
devSourcemap: true
|
|
|
|
}
|
2022-02-10 15:26:11 -05:00
|
|
|
});
|