Skip to content

Commit bf02dae

Browse files
committed
Merge pull request reduxjs#1372 from rackt/lodash-es
Use lodash-es in ES Modules build
2 parents 3cec2c4 + f4499f4 commit bf02dae

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
"plugins": [
2525
["transform-es2015-modules-commonjs", { "loose": true }]
2626
]
27+
},
28+
"es": {
29+
"plugins": [
30+
"./build/use-lodash-es"
31+
]
2732
}
2833
}
2934
}
File renamed without changes.

build/use-lodash-es.js

+10
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

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"scripts": {
1414
"clean": "rimraf lib dist es coverage",
15-
"lint": "eslint src test examples",
15+
"lint": "eslint src test examples build",
1616
"test": "cross-env BABEL_ENV=commonjs mocha --compilers js:babel-register --recursive",
1717
"test:watch": "npm test -- --watch",
1818
"test:cov": "cross-env BABEL_ENV=commonjs babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
@@ -24,7 +24,7 @@
2424
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack src/index.js dist/redux.js",
2525
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack src/index.js dist/redux.min.js",
2626
"build:examples": "cross-env BABEL_ENV=commonjs babel-node examples/buildAll.js",
27-
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && node ./prepublish",
27+
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && node ./build/es3ify",
2828
"prepublish": "npm run clean && npm run check:src && npm run build",
2929
"docs:clean": "rimraf _book",
3030
"docs:prepare": "gitbook install",
@@ -59,7 +59,8 @@
5959
},
6060
"homepage": "http://rackt.github.io/redux",
6161
"dependencies": {
62-
"lodash": "^4.2.0",
62+
"lodash": "^4.2.1",
63+
"lodash-es": "^4.2.1",
6364
"loose-envify": "^1.1.0"
6465
},
6566
"devDependencies": {

0 commit comments

Comments
 (0)