-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add support for .cjs config files #10599
Conversation
const cwd = await fs.promises.mkdtemp(os.tmpdir() + path.sep + name); | ||
const tmp = name => path.join(cwd, name); | ||
const config = name => | ||
fs.promises.copyFile(fixture("config-files-templates", name), tmp(name)); |
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.
fs.promises
is not supported until 10.x
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.
Oh right 🤦♂️
Docs added to babel/website#2106 |
cc8aa30
to
85728a3
Compare
85728a3
to
d69f9ce
Compare
const ROOT_CONFIG_FILENAMES = [ | ||
BABEL_CONFIG_JS_FILENAME, | ||
BABEL_CONFIG_JSON_FILENAME, | ||
"babel.config.js", |
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.
What about .mjs
? Would that be an issue in the future?
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.
We don't support configurations which must be loaded asynchronously (like es modules) yet.
@fisker In our tests there isn't that warning 🤔 |
@fisker |
The three commits should be reviewed one by one:
babel.config.cjs
and.babelrc.js
test.each
(since we are testing the same things for each config file)I'm marking this PR as
High Priority
because we need it to support using Babel in packages using"type": "module"
in their package.json. Note that while ES modules are still experimental in Node 13.0.0, they will be enabled by default in 13.1.0 (https://twitter.com/jasnell/status/1184265267951493120).