-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
💻
- Would you like to work on a fix?
How are you using Babel?
babel-loader (webpack)
Input code
Configuration file name
No response
Configuration
No response
Current and expected behavior
In our monorepo, one of the packages has a line like:
import module, { createRequire } from 'module';
for the actual node Module API. On a recent upgrade attempt (@babel/parser 7.19.4 -> 7.20.1 I believe), we were seeing Support for the experimental syntax 'importReflection' isn't currently enabled, however, this is not an attempted usage of importReflection. I suspect the logic introduced in this PR incorrectly flags this case as importReflection.
Workaround was to simply change the default import name.
Expected behavior would be for module to work as a default import name when also importing named functions, regardless of importReflection status.
Environment
System:
OS: Linux 5.4 Ubuntu 18.04.5 LTS (Bionic Beaver)
Binaries:
Node: 16.13.2 - /nail/tmp/xfs-d1ce38f1/node
Yarn: 3.2.0 - /nail/tmp/xfs-d1ce38f1/yarn
npm: 8.1.2 - /opt/nodejs/node-v16.13.2/bin/npm
Monorepos:
Yarn Workspaces: 3.2.0
Lerna: 3.18.3
npmPackages:
@babel/core: ^7.15.5 => 7.19.3
babel-jest: ^29.1.2 => 29.1.2
babel-plugin-smart-webpack-import: ^2.0.0 => 2.0.0
jest: ^29.1.2 => 29.1.2
lerna: ^3.16.4 => 3.18.3
Possible solution
Likely a slight tweak to this logic:
| parseMaybeImportReflection(node: Undone<N.ImportDeclaration>) { |
Additional context
No response