-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
32 lines (30 loc) · 977 Bytes
/
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
import babel, { getBabelOutputPlugin } from '@rollup/plugin-babel';
import typescript from 'rollup-plugin-typescript2';
const path = require('path');
const nodeResolve = require('@rollup/plugin-node-resolve').default;
const commonjs = require('@rollup/plugin-commonjs');
const pkg = require('./package.json');
const resolve = function (...args) {
return path.resolve(__dirname, ...args);
};
const extensions = ['.js'];
module.exports = {
input: resolve('./src/index.ts'),
output: [
{ file: './lib/index.cjs.js', format: 'cjs' },
{ file: './lib/index.esm.js', format: 'esm' },
],
plugins: [
typescript({
tsconfigOverride: { compilerOptions: { module: 'es2015' } },
}),
nodeResolve({ extensions }),
commonjs(),
babel({
extensions,
babelHelpers: 'runtime',
exclude: 'node_modules/**', // 只编译我们的源代码
}),
getBabelOutputPlugin({ presets: [['@babel/preset-env', { modules: false }]] }),
],
};