[Bug]: plugin-transform-modules-systemjs transformation is unsafe
See original GitHub issue💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform
, babel.parse
)
Input code
REPL.
import { x } from './x.js';
if (true) {
const x = 1;
console.log(x);
}
new (class extends x {})();
Configuration file name
No response
Configuration
Using @babel/plugin-transform-modules-systemjs
, nothing else
Current and expected behavior
I would expect the x = 1
to declare a local constant, as it does in the original code. Instead, it assigns to a new module-level variable (which in this case has the same name as an import, causing an error).
Environment
System:
OS: macOS 10.15.7
Binaries:
Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
npmPackages:
@babel/core: ^7.15.8 => 7.15.8
@babel/plugin-proposal-dynamic-import: ^7.14.5 => 7.14.5
@babel/plugin-transform-modules-systemjs: ^7.15.4 => 7.15.4
Possible solution
No response
Additional context
cc @guybedford 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
A Bug Undergoes One of Nature's More Startling ... - YouTube
The salmon fly nymph is in a race against time: in order to breathe, it will need to break out of its hardened...
Read more >Transformation for "A Dangerous Harvest" while on Taxi bugs ...
The Ardenweald WQ “A Dangerous Harvest” transforms you into a moth with a vehicle bar. While taking a taxi from Glitterfall Basin to...
Read more >Wrong rendering of transformed fonts on Windows with Java 6
JDK-6591278 : Wrong rendering of transformed fonts on Windows with Java 6. Type: Bug; Component: client-libs; Sub-Component: 2d; Affected Version: 6.
Read more >Learning Graph Transformations to Detect and Fix Bugs in ...
We present a learning-based approach to detect and fix a broad range of bugs in. Javascript programs. We frame the problem in terms...
Read more >The next step towards a bug bounty program for the ... - 18F
The TTS Bug Bounty will be a security initiative to pay people for identifying bugs and security holes in software operated by the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d like to work on this issue?
Yeah, I can do that.