Skip to content

Commit

Permalink
feat: Use package.json's main to get esbuild's outfile (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu authored Mar 4, 2024
1 parent 1d20e2b commit 635c014
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion template/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import fs from "fs";
import * as esbuild from 'esbuild';

const loadJSON = (path) =>
JSON.parse(fs.readFileSync(new URL(path, import.meta.url)));
const data = loadJSON("package.json");

const options = {
entryPoints: ['src/index.ts'],
bundle: true,
Expand All @@ -9,7 +14,7 @@ const options = {
external: ['coc.nvim'],
platform: 'node',
target: 'node18',
outfile: 'lib/index.js',
outfile: data.main,
};

if (process.argv.length > 2 && process.argv[2] === '--watch') {
Expand Down

0 comments on commit 635c014

Please sign in to comment.