sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 126 forks source link

External libraries should not be included in eval-*.mjs output #567

Closed leon closed 5 days ago

leon commented 2 weeks ago

When writing custom plugins for esbuild or including other packages in your sst.config.ts it should not bundle them into the eval-*.mjs file.

https://github.com/sst/ion/blob/dev/pkg/js/js.go#L39

Maybe we should set External to * or use Packages: esbuild.PackagesExternal?

leon commented 2 weeks ago

tried setting External: []string{ "*" }, but then when I run sst dev it fails with

Error evaluating config: exit status 1\nnode:internal/modules/esm/get_format:160\n  throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);\n        ^\n\nTypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension \".ts\"
leon commented 2 weeks ago

completely removing Externals and replacing with Packages: esbuild.PackagesExternal, seems to have solved it. both eval/.mjs and platform/eval/.mjs look good

will create PR