-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.js
38 lines (35 loc) · 1001 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 { readFileSync } = require("fs");
const path = require("path");
const commonjs = require("@rollup/plugin-commonjs");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const replace = require("@rollup/plugin-replace");
const nodeExternals = require("rollup-plugin-node-externals");
const sucrase = require("@rollup/plugin-sucrase");
const pkg = JSON.parse(
readFileSync(path.join(__dirname, "package.json"), "utf8")
);
const fullVersion = pkg.version;
const [major] = fullVersion.split(".").map(Number);
module.exports = {
input: ["src/actions/main.js", "src/actions/pre.js"],
output: {
dir: "dist",
format: "cjs",
// Don't include hash since this is a NodeJS module we check in
chunkFileNames: "[name].js",
},
plugins: [
sucrase({
transforms: ["jsx"],
jsxPragma: "h",
production: true,
}),
replace({
__PKG_FULL_VERSION__: JSON.stringify(fullVersion),
__PKG_MAJOR_VERSION__: major,
}),
nodeResolve(),
commonjs(),
nodeExternals(),
],
};