Skip to content

Commit 36827e3

Browse files
committed
Add node_modules back to the build so axios is available
1 parent cefdc19 commit 36827e3

File tree

6 files changed

+529
-119
lines changed

6 files changed

+529
-119
lines changed

.vscodeignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ vsc-extension-quickstart.md
88
**/.eslintrc.json
99
**/*.map
1010
**/*.ts
11+
12+
.vscode
13+
src/
14+
tsconfig.json
15+
webpack.config.js
16+
esbuild.js

esbuild.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const esbuild = require("esbuild");
2+
3+
const production = process.argv.includes("--production");
4+
const watch = process.argv.includes("--watch");
5+
6+
async function main() {
7+
const ctx = await esbuild.context({
8+
entryPoints: ["src/extension.ts"],
9+
bundle: true,
10+
format: "cjs",
11+
minify: production,
12+
sourcemap: !production,
13+
sourcesContent: false,
14+
platform: "node",
15+
outfile: "dist/extension.js",
16+
external: ["vscode"],
17+
logLevel: "silent",
18+
plugins: [
19+
/* add to the end of plugins array */
20+
esbuildProblemMatcherPlugin,
21+
],
22+
});
23+
if (watch) {
24+
await ctx.watch();
25+
} else {
26+
await ctx.rebuild();
27+
await ctx.dispose();
28+
}
29+
}
30+
31+
/**
32+
* @type {import('esbuild').Plugin}
33+
*/
34+
const esbuildProblemMatcherPlugin = {
35+
name: "esbuild-problem-matcher",
36+
37+
setup(build) {
38+
build.onStart(() => {
39+
console.log("[watch] build started");
40+
});
41+
build.onEnd((result) => {
42+
result.errors.forEach(({ text, location }) => {
43+
console.error(`✘ [ERROR] ${text}`);
44+
console.error(
45+
` ${location.file}:${location.line}:${location.column}:`
46+
);
47+
});
48+
console.log("[watch] build finished");
49+
});
50+
},
51+
};
52+
53+
main().catch((e) => {
54+
console.error(e);
55+
process.exit(1);
56+
});

0 commit comments

Comments
 (0)