forked from rematch/rematch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
39 lines (33 loc) · 1.01 KB
/
Copy pathrollup.config.js
File metadata and controls
39 lines (33 loc) · 1.01 KB
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
import replace from 'rollup-plugin-replace'
import uglify from 'rollup-plugin-uglify'
import commonJs from 'rollup-plugin-commonjs'
import { minify } from 'uglify-es'
// experimental minifier for ES modules
// https://github.com/TrySound/rollup-plugin-uglify#warning
const pkg = require('./package.json')
const env = process.env.NODE_ENV
const config = {
input: 'lib/index.js',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(env),
}),
commonJs()
],
output: [
{ name: 'RematchLoading', file: pkg.browser, format: 'umd', exports: 'named', sourcemap: true }, // Universal Modules
{ file: pkg.main, format: 'cjs', exports: 'named', sourcemap: true }, // CommonJS Modules
{ file: pkg.module, format: 'es', exports: 'named', sourcemap: true } // ES Modules
],
}
if (env === 'production') {
config.plugins.push(uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
}, minify))
}
export default [config]