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
Support file extensions in Babel build #335
Conversation
modules/dev-tools/scripts/build.sh
Outdated
@@ -5,6 +5,7 @@ set -e | |||
DEV_TOOLS_DIR=`node -e "require('ocular-dev-tools/node/module-dir')()"` | |||
CONFIG=`node $DEV_TOOLS_DIR/node/get-config.js ".babel.configPath"` | |||
MODULES=`node $DEV_TOOLS_DIR/node/get-config.js ".modules" | sed -E "s/,/ /g"` | |||
EXTENSIONS=".es6,.js,.es,.jsx,.mjs" |
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.
This is the current @babel/cli
default - it was easier to specify here than leave out.
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 typically handle things like this in ocular-dev-tools.js config file.
Regardless of how we do it, let's make sure we also update the docs.
In particular, I assume the babel defaults have to be repeated when overriding so maybe mention that in the docs and list them out?
I assume this is for adding typescript files - we could consider supporting those by default. i.e. the mere act of allowing typescript doesn't force repos to start using it...
Makes sense, I can move the settings there.
Will do.
This is for TS via Babel, which seemed like the best option. I didn't add |
Understood. Seems reasonable as a first step. Not clear why the |
I see, they are interpreted as |
At present, it isn't possible to specify a custom list of file extensions to build in
babel.config.js
- see babel/babel#8652. There's an open PR for this support in Babel, but at the moment the only way to convince the Babel CLI to parse files with extensions other than.js
and.jsx
is to provide the list on the command line.This PR adds support for custom extensions via
ocular build --extensions ".js,.ts"
, allowing the use ofocular-dev-tools
for Typescript via@babel/preset-typescript
.