Skip to content

Use lodash-es in ES Modules build #1372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"plugins": [
["transform-es2015-modules-commonjs", { "loose": true }]
]
},
"es": {
"plugins": [
"./build/use-lodash-es"
]
}
}
}
File renamed without changes.
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')
}
}
}
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"scripts": {
"clean": "rimraf lib dist es coverage",
"lint": "eslint src test examples",
"lint": "eslint src test examples build",
"test": "cross-env BABEL_ENV=commonjs mocha --compilers js:babel-register --recursive",
"test:watch": "npm test -- --watch",
"test:cov": "cross-env BABEL_ENV=commonjs babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive",
Expand All @@ -24,7 +24,7 @@
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack src/index.js dist/redux.js",
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack src/index.js dist/redux.min.js",
"build:examples": "cross-env BABEL_ENV=commonjs babel-node examples/buildAll.js",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && node ./prepublish",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min && node ./build/es3ify",
"prepublish": "npm run clean && npm run check:src && npm run build",
"docs:clean": "rimraf _book",
"docs:prepare": "gitbook install",
Expand Down Expand Up @@ -59,7 +59,8 @@
},
"homepage": "http://rackt.github.io/redux",
"dependencies": {
"lodash": "^4.2.0",
"lodash": "^4.2.1",
"lodash-es": "^4.2.1",
"loose-envify": "^1.1.0"
},
"devDependencies": {
Expand Down