豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit f12f251

Browse files
committed
fix(bazel): esbuild ESM bundles should prioritize ESM main field
ESBuild by default with `platform: node` will prioritize `main` and then check `module` if present. We want it the other way around as ES modules are easier to bundle and guaranteed to work.
1 parent 798dbd9 commit f12f251

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bazel/esbuild/index.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def esbuild_esm_bundle(name, **kwargs):
2929

3030
args = dict(
3131
resolveExtensions = [".mjs", ".js", ".json"],
32+
mainFields = ["module", "main"],
3233
outExtension = {".js": ".mjs"},
3334
# Workaround for: https://github.com/evanw/esbuild/issues/1921.
3435
banner = {

0 commit comments

Comments
 (0)