https://github.com/jamesplease/babel-module-inconsistency
This demonstrates the behavior of the es2015 modules=>CJS transform for Babel
https://github.com/jamesplease/babel-module-inconsistency
Last synced: 3 months ago
JSON representation
This demonstrates the behavior of the es2015 modules=>CJS transform for Babel
- Host: GitHub
- URL: https://github.com/jamesplease/babel-module-inconsistency
- Owner: jamesplease
- Created: 2015-12-28T18:57:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-28T19:10:56.000Z (over 9 years ago)
- Last Synced: 2025-02-07T09:42:01.514Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Babel 6.1.2 appears to have an inconsistency in how it transpiles ES2015
modules to CommonJS, specifically when the exported module uses
`export default`.This example involves the module `test.js`, which is a simple file that
exports a string as the default value.There are two behaviors that this repository shows.
### Correct behavior
The module should be exported as:
```js
{
default: "foo"
}
```This is observed when the source file is transpiled with the `babel` CLI
command.A handy shortcut to observe this is to run `npm run babel-compile`.
### Incorrect behavior
The module is exported as:
```js
"foo"
```This can be observed in two ways: using `babel-node` or using `babel-register`.
There are two shortcuts for running this:
- `npm run babel-node`
- `npm run babel-register`