diff --git a/.eslintignore b/.eslintignore index 32909b2..e019f3c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ -npm node_modules -build \ No newline at end of file +node_modules/ + +main.js diff --git a/esbuild.config.mjs b/esbuild.config.mjs index eac3f92..c13d693 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -9,9 +9,9 @@ if you want to view the source, please visit the github repository of this plugi */ `; -const prod = (process.argv[2] === 'production'); +const prod = (process.argv[2] === "production"); -esbuild.build({ +const context = await esbuild.context({ banner: { js: banner, }, @@ -41,3 +41,10 @@ esbuild.build({ treeShaking: true, outfile: 'dist/main.js', }).catch(() => process.exit(1)); + +if (prod) { + await context.rebuild(); + process.exit(0); +} else { + await context.watch(); +} diff --git a/package.json b/package.json index 03a4d16..6819898 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", - "esbuild": "0.14.47", + "esbuild": "0.17.3", "eslint": "^8.29.0", "jest": "^28.1.1", "monkey-around": "^2.3.0",