-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
49 lines (48 loc) · 1.29 KB
/
rollup.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
45
46
47
48
49
import ts from 'rollup-plugin-typescript2'
import path, { dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
export default {
input: './lib/index.ts',
output: [
{
file: path.resolve(__dirname, './dist/index.esm.js'),
format: 'es',
name:"Design",
globals: 'Design', //全局变量名字
sourcemap: true,
},
{
file: path.resolve(__dirname, './dist/index.cjs.js'),
format: 'cjs',
name:"Design",
globals: 'Design', //全局变量名字
sourcemap: true,
},
{
file: path.resolve(__dirname, './dist/index.umd.js'),
format: 'umd',
name:"Design",
globals: 'Design', //全局变量名字
sourcemap: true,
},
],
plugins: [
resolve(), // 解析 node_modules 中的依赖
commonjs(), // 将 CommonJS 模块转换为 ES6
ts(),
serve({
open: false, //是否自动打开浏览器
port: 3000,
contentBase: './',
historyApiFallback: true,
host: 'localhost',
openPage: '/index.html',
}),
livereload(),
],
}