-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
78 lines (75 loc) · 2.17 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import nodePolyfills from "rollup-plugin-node-polyfills";
import pkg from "./package.json";
import { yoniusRollup } from "yonius";
const nodePath = process.env.NODE_PATH
? process.platform === "win32"
? process.env.NODE_PATH.split(/;/)
: process.env.NODE_PATH.split(/:/)
: null;
const banner =
"/**\n" +
` * PERI Templating API (for Javascript) ${pkg.version}.\n` +
" *\n" +
` * Copyright (c) 2014-${new Date().getFullYear()} Platforme International.\n` +
" *\n" +
" * This source code is licensed under the Apache 2.0 license found in the\n" +
" * LICENSE file in the root directory of this source tree.\n" +
" */";
export default [
{
input: "js/index.js",
output: {
name: "ripeTemplating",
file: pkg.browser,
banner: banner,
format: "umd",
exports: "named",
sourcemap: true
},
plugins: [
yoniusRollup(),
nodePolyfills(),
resolve({
customResolveOptions: {
paths: nodePath
}
}),
commonjs(),
babel({
babelrc: false,
babelHelpers: "bundled",
presets: ["@babel/preset-env"]
})
]
},
{
input: "js/index.js",
external: ["node-fetch", "fs", "process", "path"],
output: [
{
file: pkg.main,
banner: banner,
format: "cjs",
exports: "named",
sourcemap: true
},
{
file: pkg.module,
banner: banner,
format: "es",
sourcemap: true
}
],
plugins: [
commonjs(),
resolve({
customResolveOptions: {
paths: nodePath
}
})
]
}
];