-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.client.js
48 lines (47 loc) · 1.46 KB
/
rollup.config.client.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
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs';
import { string } from 'rollup-plugin-string';
import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import replace from '@rollup/plugin-replace';
import css from 'rollup-plugin-css-only';
import copy from 'rollup-plugin-copy';
import nodePolyfills from 'rollup-plugin-polyfill-node';
const isProduction = process.env.NODE_ENV === 'production';
export default {
input: 'src/client.entry.js',
output: {
file: 'dist/public/bundle.js',
format: 'iife',
inlineDynamicImports: true
},
plugins: [
string({
// Required for the markup files
include: /\.md$/i
}),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
resolve(),
babel({
//https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
babelHelpers: 'bundled',
presets: ['@babel/preset-react'],
exclude: 'node_modules/**'
}),
json(),
commonjs(),
nodePolyfills({ process: true }), //Used in the syntax highlighter while parsing the README.md
isProduction && terser(),
css({
output: 'styles.css', // Output file name and path for the bundled CSS
minimize: isProduction // Minify the CSS
}),
copy({
targets: [{ src: 'resources/*', dest: 'dist/public' }]
})
]
};