shareon-pulsanti-condivisio.../vite.config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
699 B
JavaScript
Raw Permalink Normal View History

2022-02-10 21:26:11 +01:00
import { defineConfig } from "vite";
2022-02-10 22:21:09 +01:00
import * as path from "node:path";
2022-02-10 21:26:11 +01:00
export default defineConfig({
build: {
lib: {
entry: path.resolve("./src/index.js"),
name: "Shareon",
formats: ["es", "umd", "iife"],
2023-01-25 18:19:33 +01:00
// Workaround to keep the old file names
2023-01-25 18:30:39 +01:00
fileName: (format) => `shareon.${format}.js`,
2022-02-10 21:26:11 +01:00
},
2022-02-10 21:44:35 +01:00
rollupOptions: {
output: {
2023-01-25 18:27:00 +01: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 21:44:35 +01:00
},
},
2022-02-10 21:26:11 +01:00
},
2023-01-25 18:27:20 +01:00
css: {
2023-01-25 18:30:39 +01:00
devSourcemap: true,
},
2022-02-10 21:26:11 +01:00
});