-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
48 lines (43 loc) · 1.11 KB
/
rollup.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
const nodeResolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const babel = require('rollup-plugin-babel')
const replace = require('rollup-plugin-replace')
const { terser } = require('rollup-plugin-terser')
const fs = require('fs')
const env = process.env.NODE_ENV
const isProd = env === 'production'
// const { node } = process.versions
const { version } = fs.readFileSync('./package.json', 'utf8')
const config = {
input: 'src/index.js',
external: [],
output: {
name: 'urisanity',
globals: {
},
format: 'umd',
sourcemap: true
// banner: `/*!\r\n * URISanity: Date=${new Date()};NodeBuildVersion=${parseInt(String(node))}\r\n *\r\n */\r\n`
},
plugins: [
nodeResolve({
jsnext: true,
main: true,
browser: true,
extensions: ['.js']
}),
commonjs(),
babel({
exclude: ['node_modules/**']
}),
replace({
exclude: ['node_modules/**'],
'process.env.NODE_ENV': JSON.stringify(env),
VERSION: `'${version}'`
})
]
}
if (isProd) {
config.plugins.push(terser())
}
module.exports = config