-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrollup.config.mjs
50 lines (48 loc) · 1.39 KB
/
rollup.config.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
import path from 'path';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import analyze from 'rollup-plugin-analyzer';
import alias from '@rollup/plugin-alias';
import { addCssImports } from './scripts/add-css-imports';
const isDevMode = process.env.NODE_ENV === 'development';
export default {
input: 'src/index.js',
output: {
dir: isDevMode ? './examples/node_modules/@hh.ru/react-d3-chart-graphs/' : './dist/',
format: 'esm',
sourcemap: isDevMode,
},
cache: false,
plugins: [
alias({
entries: [
{
find: /^src\/(.*)/,
replacement: path.resolve(__dirname, 'src/$1'),
},
],
}),
resolve({
extensions: ['.js', '.jsx', '.css'],
}),
commonjs(),
postcss({
extract: 'styles.css',
minimize: !isDevMode,
sourceMap: isDevMode,
}),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}),
terser({
compress: !isDevMode,
mangle: !isDevMode,
}),
analyze({ summaryOnly: true }),
addCssImports,
],
};