Skip to content

Commit

Permalink
feat(esbuild): watch mode back
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward committed Apr 28, 2023
1 parent dd0c8e7 commit 1057da3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
18 changes: 0 additions & 18 deletions esbuild.js

This file was deleted.

24 changes: 24 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as esbuild from 'esbuild';

const options = {
entryPoints: ['src/index.ts'],
bundle: true,
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV === 'development',
mainFields: ['module', 'main'],
external: ['coc.nvim'],
platform: 'node',
target: 'node14.14',
outfile: 'lib/index.js',
};

if (process.argv.length > 2 && process.argv[2] === '--watch') {
const ctx = await esbuild.context(options);
await ctx.watch();
console.log('watching...');
} else {
const result = await esbuild.build(options);
if (result.errors.length) {
console.error(result.errors);
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"schema": "curl -o schemas/pyrightconfig.schema.json https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json && node diff.mjs",
"clean": "rimraf lib",
"lint": "eslint src --ext ts",
"build": "node esbuild.js",
"prepare": "node esbuild.js"
"build": "node esbuild.mjs",
"prepare": "node esbuild.mjs"
},
"devDependencies": {
"@types/diff-match-patch": "^1.0.32",
Expand Down

0 comments on commit 1057da3

Please sign in to comment.