Skip to content

Commit

Permalink
Use lodash-es for es and rollup builds
Browse files Browse the repository at this point in the history
This was taken from react-redux. :)
  • Loading branch information
tusbar committed Aug 16, 2017
1 parent 51d27da commit 300cfcc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@
"stage-1"
],
"plugins": [
"external-helpers"
"external-helpers",
"./build/use-lodash-es"
]
},
"jsnext": {
"presets": [
["es2015", { "modules": false, "loose": true }],
"react",
"stage-1"
],
"plugins": [
"./build/use-lodash-es"
]
}
}
Expand Down
10 changes: 10 additions & 0 deletions build/use-lodash-es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = function() {
return {
visitor: {
ImportDeclaration(path) {
var source = path.node.source
source.value = source.value.replace(/^lodash($|\/)/, 'lodash-es$1')
},
},
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"dependencies": {
"babel-runtime": "^6.25.0",
"lodash": "^4.0.0",
"lodash-es": "^4.0.0",
"warning": "^3.0.0"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,10 @@ locate-path@^2.0.0:
p-locate "^2.0.0"
path-exists "^3.0.0"

lodash-es@^4.0.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7"

lodash.cond@^4.3.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"
Expand Down

0 comments on commit 300cfcc

Please sign in to comment.