-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrollup.example.mjs
93 lines (87 loc) · 1.85 KB
/
rollup.example.mjs
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import scss from 'rollup-plugin-scss'
import terser from "@rollup/plugin-terser";
import serve from 'rollup-plugin-serve';
import cssnano from 'cssnano';
import postcss from 'postcss';
import pkg from './package.json' assert { type: 'json' };
const index = 'src/js/index.js';
const dependencies = Object.keys(pkg.dependencies);
export default [
// browser-friendly UMD build
{
input: index,
external: dependencies,
output: [
{
file: pkg.browser,
format: 'umd',
name: 'wb',
globals: {
_: '_',
d3: 'd3',
},
sourcemap: true,
},
],
plugins: [
commonjs(),
resolve(),
babel({
babelrc: false,
presets: ['@babel/preset-env'],
exclude: ['node_modules/**']
}),
terser(),
serve({
verbose: true,
contentBase: 'public',
host: '0.0.0.0',
port: 8093
})
],
},
// CommonJS (for Node) and ES module (for bundlers) build.
{
input: index,
external: dependencies,
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
},
],
plugins: [
commonjs(),
resolve(),
babel({
babelrc: false,
presets: ['@babel/env'],
exclude: ['node_modules/**']
}),
],
},
//styles
{
input: 'src/sass/radialTree.scss',
output: {
format: 'es',
},
plugins: [
scss({
processor: css => postcss([cssnano])
.process(css)
.then(result => result.css),
output: 'build/radial-tree.css',
})
],
},
];