-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
executable file
·55 lines (51 loc) · 1.27 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
49
50
51
52
53
54
55
import autoprefixer from "autoprefixer";
import commonjs from "rollup-plugin-commonjs";
import nodeResolve from "rollup-plugin-node-resolve";
import postcss from "rollup-plugin-postcss";
// code for using uglify-es modified from https://github.com/TrySound/rollup-plugin-uglify
const minify = require("uglify-es").minify; // eslint-disable-line
function uglify(userOptions) {
const options = Object.assign(
{
sourceMap: true
},
userOptions
);
return {
name: "uglify",
transformBundle(code) {
const result = minify(code, options);
if (result.error) {
throw result.error;
}
return result;
}
};
}
export default {
input: "src/main.js",
output: {
file: "dist/bundle.js",
format: "iife", // change to 'iife' for production, 'es' to test
sourcemap: true,
banner: "/* https://www.elsewebdevelopment.com/ */"
},
plugins: [
nodeResolve({
jsnext: true, // Default: false
main: true,
browser: true // Default: false
}),
commonjs({
// if false then skip sourceMap generation for CommonJS modules
sourceMap: true // Default: true
}),
postcss({
plugins: [autoprefixer()],
sourceMap: true,
extract: true,
minimize: true
}),
uglify()
]
};