Skip to content

Conversation

@goto-bus-stop
Copy link
Contributor

Babel can load ES module config files (.babelrc.js, babel.config.js), but only when it is used asynchronously. This PR implements that.

When loading an ESM config file, Babel uses dynamic import(), which means the config file itself will also be passed to @node-loader/babel. We cannot transform a config file with babel, since we need the config file to know what to do in the first place. So possibly-ESM babel config files must be ignored by the loader.

Thanks!

Copy link

@internettrans internettrans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@internettrans internettrans merged commit 74723e8 into node-loader:master Jul 3, 2021
@internettrans
Copy link

Released in https://github.com/node-loader/node-loader-babel/releases/tag/v1.1.0. I did a follow up commit in c0ae976 to expand isBabelConfig to support commonjs file extensions, too

@goto-bus-stop goto-bus-stop deleted the async-babel branch July 26, 2021 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants