I want it to export this ts entry
with a export default (so I can dynamically import it in browser) not as shown below:
I ran esbuild like so:
"esbuild": "esbuild src/i18n/en.ts --bundle --outfile=dist/i18n/en.js",
To specify the format of the output, esbuild has the flag --format
.
To emit esm you can use --format=esm
.
The default for --format
depends on what other options you have passed. You can see when which --format
is chosen in the documentation.
The iife format will automatically be enabled when no output format is specified, bundling is enabled, and platform is set to browser (which it is by default)