-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtsup.config.ts
53 lines (51 loc) · 1.25 KB
/
tsup.config.ts
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
import type { Plugin } from "esbuild";
import { defineConfig } from "tsup";
import { copy } from "esbuild-plugin-copy";
import { polyfillNode } from "esbuild-plugin-polyfill-node";
import { dependencies } from "./package.json";
function handleWinCaNativeBinaries(): Plugin {
return {
name: "handleWinCaNativeBinaries",
setup: (build) => {
build.onLoad({ filter: /win-ca\/lib\/crypt32-\w*.node$/ }, async (args) => {
// As win-ca fallback is used, skip not required `.node` binaries
return {
contents: "",
loader: "empty",
};
});
},
};
}
export default () => [
defineConfig({
name: "node",
entry: ["src/extension.ts"],
outDir: "dist/node",
platform: "node",
target: "node18",
external: ["vscode"],
noExternal: Object.keys(dependencies),
esbuildPlugins: [
copy({
assets: [],
}),
handleWinCaNativeBinaries(),
],
clean: true,
}),
defineConfig({
name: "browser",
entry: ["src/extension.ts"],
outDir: "dist/web",
platform: "browser",
external: ["vscode"],
noExternal: Object.keys(dependencies),
esbuildPlugins: [
polyfillNode({
polyfills: { fs: true },
}),
],
clean: true,
}),
];