forked from canvg/canvg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
64 lines (57 loc) · 1.4 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
56
57
58
59
60
61
62
63
64
/* eslint-env node */
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import json from "rollup-plugin-json";
import replace from "rollup-plugin-replace";
import alias from "rollup-plugin-alias";
import pkgConfig from "./package.json";
let is_node = process.env.IS_NODE === "1";
let globals = { "stackblur-canvas": "StackBlur", rgbcolor: "RGBColor" };
let external = ["stackblur-canvas", "rgbcolor"];
let plugins = [
replace({
"nodeEnv = isNode": is_node ? "nodeEnv = true;" : "nodeEnv = false;"
}),
commonjs(),
resolve(),
json()
];
if (is_node) {
external = external.concat(["canvas", "xmldom", "jsdom"]);
globals.canvas = "canvas";
globals.xmldom = "xmldom";
globals.jsdom = "jsdom";
} else {
plugins = [
alias({
canvas: "./dummy.js",
jsdom: "./dummy.js",
xmldom: "./dummy.js"
})
].concat(plugins);
}
let input = "./src/canvg.js",
output = {
file: is_node ? "./dist/node/canvg.js" : "./dist/browser/canvg.js",
format: "umd",
exports: "default",
name: "canvg",
globals: globals,
banner: `
/*
* canvg.js - Javascript SVG parser and renderer on Canvas
* version ${pkgConfig.version}
* MIT Licensed
* Gabe Lerner ([email protected])
* https://github.com/canvg/canvg
*
*/
`,
extend: false
};
export default {
input: input,
plugins: plugins,
output: output,
external: external
};