Skip to content

Commit 746c450

Browse files
btdtimdorr
authored andcommitted
Add es2015 modules export from redux project (#501)
* Remove Style section Obviously that didn't happen... * Add es2015 modules export from redux project
1 parent b6e29ea commit 746c450

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

.babelrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@
1818
"transform-es2015-parameters",
1919
["transform-es2015-destructuring", { "loose": true }],
2020
"transform-es2015-block-scoping",
21-
["transform-es2015-modules-commonjs", { "loose": true }],
2221
"transform-object-rest-spread",
2322
"transform-react-jsx",
2423
"syntax-jsx"
2524
],
2625
"env": {
2726
"test": {
2827
"plugins": ["istanbul"]
28+
},
29+
"commonjs": {
30+
"plugins": [
31+
["transform-es2015-modules-commonjs", { "loose": true }]
32+
]
33+
},
34+
"es": {
35+
"plugins": [
36+
"./build/use-lodash-es"
37+
]
2938
}
3039
}
3140
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist
55
lib
66
.nyc_output
77
coverage
8+
es

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ npm run lint
5454

5555
Please open an issue with a proposal for a new feature or refactoring before starting on the work. We don't want you to waste your efforts on a pull request that we won't want to accept.
5656

57-
###Style
58-
59-
[reactjs](https://github.com/reactjs) is trying to keep a standard style across its various projects, which can be found over in [eslint-config-reactjs](https://github.com/reactjs/eslint-config-reactjs). If you have a style change proposal, it should first be proposed there. If accepted, we will be happy to accept a PR to implement it here.
60-
6157
## Submitting Changes
6258

6359
* Open a new issue in the [Issue tracker](https://github.com/reactjs/react-redux/issues).

build/use-lodash-es.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = function () {
2+
return {
3+
visitor: {
4+
ImportDeclaration(path) {
5+
var source = path.node.source
6+
source.value = source.value.replace(/^lodash($|\/)/, 'lodash-es$1')
7+
}
8+
}
9+
}
10+
}

package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
"version": "4.4.5",
44
"description": "Official React bindings for Redux",
55
"main": "./lib/index.js",
6+
"module": "es/index.js",
7+
"jsnext:main": "es/index.js",
68
"scripts": {
7-
"build:lib": "babel src --out-dir lib",
8-
"build:umd": "cross-env NODE_ENV=development webpack src/index.js dist/react-redux.js",
9-
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/react-redux.min.js",
10-
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min && node ./prepublish",
11-
"clean": "rimraf lib dist coverage",
9+
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
10+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
11+
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack src/index.js dist/redux.js",
12+
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack src/index.js dist/redux.min.js",
13+
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
14+
"clean": "rimraf lib dist es coverage",
1215
"lint": "eslint src test",
1316
"prepublish": "npm run clean && npm run build",
14-
"test": "cross-env NODE_ENV=test mocha --compilers js:babel-register --recursive --require ./test/setup.js",
17+
"test": "cross-env BABEL_ENV=commonjs NODE_ENV=test mocha --compilers js:babel-register --recursive --require ./test/setup.js",
1518
"test:watch": "npm test -- --watch",
1619
"test:cov": "cross-env NODE_ENV=test nyc npm test",
1720
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
@@ -23,7 +26,8 @@
2326
"files": [
2427
"dist",
2528
"lib",
26-
"src"
29+
"src",
30+
"es"
2731
],
2832
"keywords": [
2933
"react",
@@ -95,6 +99,7 @@
9599
"hoist-non-react-statics": "^1.0.3",
96100
"invariant": "^2.0.0",
97101
"lodash": "^4.2.0",
102+
"lodash-es": "^4.2.0",
98103
"loose-envify": "^1.1.0"
99104
},
100105
"peerDependencies": {

0 commit comments

Comments
 (0)