Skip to content

Commit 41780a2

Browse files
jaridmargolinyangmillstheory
authored andcommitted
Utilize lodash-es in es builds. (#206)
1 parent be197d1 commit 41780a2

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.babelrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
"presets": [
33
"./build/preset-es2015",
44
"stage-0"
5-
]
5+
],
6+
"env": {
7+
"es": {
8+
"plugins": [
9+
"./build/use-lodash-es"
10+
]
11+
}
12+
}
613
}

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 useLodashEs() {
2+
return {
3+
visitor: {
4+
ImportDeclaration(path) {
5+
const source = path.node.source;
6+
source.value = source.value.replace(/^lodash($|\/)/, 'lodash-es$1');
7+
}
8+
}
9+
};
10+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"dependencies": {
6363
"invariant": "^2.2.1",
6464
"lodash": "^4.13.1",
65+
"lodash-es": "^4.17.4",
6566
"reduce-reducers": "^0.1.0"
6667
}
6768
}

0 commit comments

Comments
 (0)