forked from cure53/DOMPurify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
38 lines (34 loc) · 906 Bytes
/
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
const nodeResolve = require('rollup-plugin-node-resolve');
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 version = process.env.npm_package_version;
const license = fs.readFileSync('./src/license_header', 'utf8').replace(/VERSION/ig, version);
const config = {
input: 'src/purify.js',
external: [],
output: {
name: 'DOMPurify',
globals: {},
format: 'umd',
sourcemap: true,
banner: license,
},
plugins: [
nodeResolve(),
babel({
exclude: ['**/node_modules/**'],
}),
replace({
'process.env.NODE_ENV': JSON.stringify(env),
VERSION: `'${version}'`,
}),
],
};
if (isProd) {
config.plugins.push(terser());
}
module.exports = config;