-
Notifications
You must be signed in to change notification settings - Fork 13
/
rollup-examples.config.js
64 lines (59 loc) · 1.62 KB
/
rollup-examples.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* eslint-env node */
import babel from 'rollup-plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
import postcssPresetEnv from 'postcss-preset-env';
import { string } from 'rollup-plugin-string';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import livereload from 'rollup-plugin-livereload';
const production = !process.env.ROLLUP_WATCH;
export default {
input: 'examples/index-public.js',
output: {
sourcemap: false,
format: 'iife',
name: 'app',
file: 'webpage-build/demos/index.js',
},
plugins: [
json(),
babel({ runtimeHelpers: true }),
nodeResolve({
browser: true,
dedupe: ['gl-matrix'],
mainFields: ['module', 'main'],
preferBuiltins: false,
}),
commonjs({
sourceMap: false,
exclude: /(umap-js|skmeans)/,
}),
string({
include: /(umap-js|skmeans)/,
}),
nodePolyfills(),
replace({
'browser.env.NODE_ENV': '"production"',
}),
postcss({
extract: true,
minimize: true,
extensions: ['.scss', '.sass', '.css'],
plugins: [
postcssFlexbugsFixes(),
postcssPresetEnv({
autoprefixer: { grid: true },
browsers: 'last 2 version, >0.25%',
stage: 3,
}),
],
}),
!production && livereload(),
production && terser(),
],
};