-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrollup.config.js
54 lines (51 loc) · 1.68 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
50
51
52
53
54
import json from '@rollup/plugin-json'
import { uglify } from 'rollup-plugin-uglify'
import typescript from 'rollup-plugin-typescript2';
const plugins = [json()]
// 生产环节开启压缩
if (process.env.NODE_ENV === 'production') {
plugins.push(uglify())
}
export default [
{
plugins,
input: './src/plugins/index.js', //入口文件
output: {
file: './dist/plugins/index.js', //打包后的存放文件
format: 'cjs', //输出格式 amd es6 iife umd cjs
name: 'bundleName' //如果iife,umd需要指定一个全局变量
}
},
{
plugins: [
json(),
uglify()
],
input: './src/project/vue2/index.js', //入口文件
output: {
file: './dist/project/vue2/index.js', //打包后的存放文件
format: 'esm', //输出格式 amd es6 iife umd cjs
name: 'bundleName' //如果iife,umd需要指定一个全局变量
},
},
{
plugins: [
json(),
uglify(),
typescript({
tsconfigOverride: {
compilerOptions: { declaration: true }, // 生成.d.ts的文件
// exclude: ["tests/**/*.ts", "tests/**/*.tsx"]
include: ['src/**/*.ts']
}
}),
],
external: ['vue'],
input: './src/project/vue3/index.ts', //入口文件
output: {
file: './dist/project/vue3/index.js', //打包后的存放文件
format: 'esm', //输出格式 amd es6 iife umd cjs
name: 'bundleName' //如果iife,umd需要指定一个全局变量
},
},
]