forked from 724493602/pixi-graph-genji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (45 loc) · 1.18 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
const path = require('path');
const resolve = require('@rollup/plugin-node-resolve').default;
const ts = require('rollup-plugin-typescript2');
const json = require('@rollup/plugin-json');
const commonjs = require('@rollup/plugin-commonjs');
const nodePolyfills = require('rollup-plugin-node-polyfills');
const { terser } = require('rollup-plugin-terser');
import babel from 'rollup-plugin-babel';
import del from 'rollup-plugin-delete';
const pkg = require(path.resolve('./package.json'));
const name = pkg.name;
const config = {
input: path.resolve('./src/index.ts'),
output: [
{
file: path.resolve(`./dist/${name}.js`),
format: 'umd',
name: name
},
{
file: path.resolve(`./dist/${name}.es.js`),
format: 'es'
},
{
file: path.resolve(`./dist/${name}.cjs.js`),
format: 'cjs'
}
],
plugins: [
nodePolyfills(),
del({ targets: 'dist/*' }),
resolve(),
ts({
tsconfig: path.resolve('./tsconfig.json'),
useTsconfigDeclarationDir: true
}),
commonjs(),
json(),
process.env.NODE_ENV === 'production' && terser(),
babel({
exclude: 'node_modules/**'
})
]
};
module.exports = [config];