Skip to content

Commit 54c59c5

Browse files
Deraendiasbruno
authored andcommitted
Export default property in CommonJS and global object
In Babel 5, the ES6 default property was exported as both default property under the CommonJS export (module.exports) and global object (in UMD wrapper, on browser). With babel 6 this behaviour was changed (babel/babel#2212) and now using library requires e.g. require("react-modal").default instead of just require("react-modal") ReactModal.default instead of ReactModal This babel plugin restores the old behaviour.
1 parent ba526cf commit 54c59c5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.babelrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"presets": ["es2015", "stage-2", "react"]
2+
"presets": ["es2015", "stage-2", "react"],
3+
"plugins": [
4+
"add-module-exports"
5+
]
36
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"babel-core": "^6.25.0",
2727
"babel-eslint": "^7.1.1",
2828
"babel-loader": "^6.2.4",
29+
"babel-plugin-add-module-exports": "^0.2.1",
2930
"babel-preset-es2015": "^6.24.1",
3031
"babel-preset-react": "^6.24.1",
3132
"babel-preset-stage-2": "^6.24.1",

0 commit comments

Comments
 (0)