-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🏗 Use ESM to import peer Bento binaries #37586
Conversation
c6da94a
to
a18da36
Compare
build-system/babel-plugins/babel-plugin-amd-custom-define/index.js
Outdated
Show resolved
Hide resolved
build-system/babel-plugins/babel-plugin-amd-custom-define/index.js
Outdated
Show resolved
Hide resolved
Hey @erwinmombay, @jridgewell! These files were changed:
Hey @rsimha! These files were changed:
|
@jridgewell this should be ready for review. PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case for a single exports default fn() {}
export? Want to make sure isn't not going to do a module.exports = fn() {}
.
Otherwise, LGTM.
build-system/babel-plugins/babel-plugin-nomodule-loader/index.js
Outdated
Show resolved
Hide resolved
build-system/babel-plugins/babel-plugin-nomodule-loader/index.js
Outdated
Show resolved
Hide resolved
build-system/babel-plugins/babel-plugin-nomodule-loader/define-template.js
Show resolved
Hide resolved
I don't know why I didn't do this originally, it's sooo much simpler. This has babel output an inline sourcemap, which is fed into esbuild. Esbuild will do an initial sourcemap-aware bundling, and output a new map that correctly points through babel into our real source files. After that, we can do the simple define/minify remapping for our post compile.
dbee1df
to
2445c9a
Compare
On
module
builds, use browser'simport
statement to share Bento dependencies likebento.mjs
.On
nomodule
builds, we can't useimport
. Instead, we use babel to output to a format similar to AMD.This change also simplifies some aspects:
{remapDependencies}
for esbuild rather thanmodule-resolver
on babel.bento
compile wrapper.src/bento.js
directly, and the intermediatebento-shared.js
module is no longer needed.