-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
41 lines (41 loc) · 1.21 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
/* eslint-disable import/no-anonymous-default-export */
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
import path from 'path';
import cleanup from 'rollup-plugin-cleanup';
export default {
input: 'src/task.ts', // 打包入口
output: {
// 打包出口
name: 'getQueryData', // namespace
file: path.resolve(__dirname, 'public/task/index.js'), // 最终打包出来的文件路径和文件名
format: 'umd', // umd/amd/cjs/iife
},
plugins: [
json(),
nodeResolve({
extensions: ['.js', '.ts'],
}),
// 解析TypeScript
typescript({
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
}),
// 将 CommonJS 转换成 ES2015 模块供 Rollup 处理
commonjs(),
// es6--> es5
babel({
babelHelpers: 'runtime',
exclude: 'node_modules/**',
presets: [['@babel/preset-env', { modules: false }]],
comments: false,
}),
cleanup(),
replace({
'console.log': '//console.log',
}),
],
};