-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.mjs
34 lines (33 loc) · 1.16 KB
/
rollup.config.mjs
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
// rollup.config.js
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
import resolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import progress from 'rollup-plugin-progress';
import packageJson from "./package.json" assert { type: "json" };
import json from "@rollup/plugin-json";
export default {
input: 'src/main.ts', // 入口文件路径
output: {
file: 'dist/XSActivity.js', // 输出文件路径
format: 'iife', // 输出格式
sourcemap: true,
name: 'XiaoSuActivity', // 全局变量名称
intro: async () => {
let XSActivity_VERSION = packageJson.version;
XSActivity_VERSION = (XSActivity_VERSION.length > 0 && XSActivity_VERSION[0] == 'v') ? XSActivity_VERSION : "v" + XSActivity_VERSION;
return `const XSActivity_VERSION="${XSActivity_VERSION}";
const DEBUG=false;`;
},
plugins: [terser({
mangle: false
})]
},
plugins: [
progress({ clearLine: true }),
resolve({ browser: true }),
typescript({ tsconfig: "./tsconfig.json", inlineSources: true }), // 使用 TypeScript 插件
commonjs(),
json()
]
};