-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
@babel/core parseSync does not handle exclude in config #11540
Copy link
Copy link
Closed
Labels
area: errorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
- I would like to work on a fix!
Current Behavior
- REPL, Codesandbox, or GitHub Repo link if applicable: https://github.com/SimenB/babel-parse-exclude
Input Code
Expected behavior/code
Passing an empty string to parseSync will throw if config file contains exclude.
Error: Configuration contains string/RegExp pattern, but no filename was passed to Babel
This is sorta documented (https://babeljs.io/docs/en/options#filename) but I find it very confusing 😀 There aren't really any parse info inferred from filename (I think?), at least not when we pass parserOpts.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
module.exports = {exclude: /react-native/};Environment
System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
npmPackages:
@babel/core: ^7.9.6 => 7.9.6
- Babel version(s): 7.9.6
- Node/npm version: v12
- OS: osx
- Monorepo: no
- How you are using Babel:
@babel/core'sparseSync
Possible Solution
I would expect this error to be suppressed when we use parse API, same as when we use @babel/parser directly.
Additional context/Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: errorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue