-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.mjs
48 lines (46 loc) · 1.14 KB
/
rollup.config.mjs
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
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import replace from "@rollup/plugin-replace";
import json from "@rollup/plugin-json";
import esbuild from "rollup-plugin-esbuild";
import pkg from "./package.json" with { type: "json" };
import tsConfig from "./tsconfig.json" with { type: "json" };
const isProd = process.env.NODE_ENV === "production";
/**
* @type {import("rollup").RollupOptions[]}
*/
export default [
{
input: "src/extension.ts",
external: ["vscode"],
output: {
// file: pkg.main,
dir: "out",
format: "cjs",
},
plugins: [
replace({
"process.env.NODE_ENV": JSON.stringify(
process.env.NODE_ENV || "development"
),
preventAssignment: true,
}),
json(),
resolve({
browser: false,
preferBuiltins: true,
}),
commonjs({
ignoreGlobal: true,
}),
esbuild({
minify: isProd,
sourceMap: !isProd,
target: tsConfig.compilerOptions.target,
define: {
__VERSION__: JSON.stringify(pkg.version),
},
}),
],
},
];