-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
45 lines (42 loc) · 1.04 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { defineConfig } from "vite";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
function removeDeveloperMode() {
return {
name: 'remove-developer-mode',
transform(code, id) {
if (id.endsWith('Text2Frame.js')) {
const startIndex = code.indexOf('// developer mode');
if (startIndex !== -1) {
return code.substring(0, startIndex);
}
}
return code;
}
};
}
export default defineConfig({
build: {
outDir: ".",
lib: {
entry: "./Text2Frame.js",
name: "Text2Frame",
formats: [
"es", // ESM
"cjs", // CommonJS
"umd", // ブラウザ向け
],
fileName: (format) => {
if (format === 'es') {
return `Text2Frame.${format}.mjs`;
} else {
return `Text2Frame.${format}.js`;
}
}
},
rollupOptions: {
plugins: [removeDeveloperMode(), resolve(), commonjs({ transformMixedEsModules: true })],
},
minify: false
},
});