Skip to content

Commit 4528744

Browse files
committed
Add babel-plugin-add-module-exports to improve common js syntax
1 parent 4f8fbe2 commit 4528744

9 files changed

Lines changed: 23 additions & 10 deletions

.babelrc

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

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ It is useful for building tree structure UI for data display and data traversal.
1919

2020
## Example
2121

22-
__In short__, it provides a function that assigns an extra field named `nodeData` to each node of your tree:
22+
__In short__, it provides a function that assigns an extra field named `nodeData` to each node of your tree.
23+
24+
[See it live here.](https://runkit.com/dlin-me/tree-node-data-demo)
25+
2326

2427
<table>
2528
<tr>
@@ -31,7 +34,7 @@ __In short__, it provides a function that assigns an extra field named `nodeData
3134

3235
```
3336
[{
34-
name: 'Software'
37+
name: 'Software',
3538
key: 1,
3639
children: [
3740
{

lib/tree-node-data.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tree-node-data.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tree-node-data.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"babel-core": "^6.26.0",
3434
"babel-eslint": "^8.0.3",
3535
"babel-loader": "^7.1.2",
36+
"babel-plugin-add-module-exports": "^0.2.1",
3637
"babel-preset-env": "^1.6.1",
3738
"babel-preset-es2015": "^6.24.1",
3839
"babel-preset-react": "^6.24.1",

src/assignNodeData.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'chai';
2-
import { assignNodeData } from './assignNodeData';
2+
import assignNodeData from './assignNodeData';
33

44
const nodes = [
55
{

webpack.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ const config = {
4343
modules: [path.resolve('./node_modules'), path.resolve('./src')],
4444
extensions: ['.json', '.js']
4545
},
46-
externals: {
47-
react: 'react',
48-
react: 'prop-types',
49-
},
5046
plugins: plugins
5147
};
5248

0 commit comments

Comments
 (0)