From c7d6a22f19fa339d553fca8b714f78bab6298a38 Mon Sep 17 00:00:00 2001 From: Tristan de Cacqueray Date: Sun, 14 Jan 2024 09:08:31 +0000 Subject: [PATCH] Document the bundler-args argument (#1164) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index b779e0220..9766f1db6 100644 --- a/README.md +++ b/README.md @@ -952,6 +952,14 @@ $ node -e "import('./index.js').then(m => console.log(m.main))" [Function] ``` +Spago does not wrap the entirety of the bundler's API (esbuild for JS builds), so it's possible to pass arguments through to it. E.g. to exclude an NPM package from the bundle you can pass the `--external` flag to esbuild: +- either through the command line, with the `--bundler-args` flag, i.e. `--bundler-args "--external:better-sqlite3"`. +- or by adding it to the configuration file: + ```yaml + package: + bundle: + extra_args: + - "--external:better-sqlite3" ### Enable source maps When bundling, you can include `--source-maps` to generate a final source map for your bundle.