Closed wclr closed 2 years ago
Not sure that it's right that this now bakes in dependencies into the js file published on npm (I believe) but those are still listed as dependencies.
I also suppose they are small and duplication doesn't matter
Didn't think about it. Bundlers are so bundlers. There is an option --external for modules not to include, but an additional build script will be needed probably. Something like that, or to use api:
const { execSync } = require("child_process");
const externals = Object.keys(require("./package.json").dependencies);
execSync(
[
"npx esbuild",
"--bundle",
"--platform=node",
"--outfile=bundle.js",
...externals.map((m) => "--external:" + m),
"./output/LanguageServer.IdePurescript.Main",
...process.argv.slice(2)
].join(" "),
{ stdio: "inherit" }
);
Otherwise, dependencies could be moved to devDependencies. Also bundled things should be faster to start, maybe.
Adds esbuild bundling to
bundle.js
,server.js
now in the repo.VScode tasks.json includes two watch tasks (tsc and bundle), that can be run in dev mode. Error matcher
$esbuild-watch
is available through vscode extension.Main.js
was modified to preventrequire
resolution byesbuild
and proper possible exception handling.Made minified
esbuild
bundle with external source maps in build mode.