From 7fbc5951c1896164a01a5e2222dd3fb599f126e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Benitte?= Date: Tue, 5 Dec 2017 23:46:59 +0900 Subject: [PATCH] fix(babel-preset): add missing ignored script --- packages/nivo-babel-preset/index.js | 2 +- packages/nivo-babel-preset/use-lodash-es.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/nivo-babel-preset/use-lodash-es.js diff --git a/packages/nivo-babel-preset/index.js b/packages/nivo-babel-preset/index.js index 00041a9ce..60a375bd2 100644 --- a/packages/nivo-babel-preset/index.js +++ b/packages/nivo-babel-preset/index.js @@ -60,7 +60,7 @@ if (env === 'commonjs') { } if (env === 'es') { - plugins.push.apply(plugins, [require.resolve('./build/use-lodash-es')]) + plugins.push.apply(plugins, [require.resolve('./use-lodash-es')]) } if (env === 'test') { diff --git a/packages/nivo-babel-preset/use-lodash-es.js b/packages/nivo-babel-preset/use-lodash-es.js new file mode 100644 index 000000000..e1eafbf94 --- /dev/null +++ b/packages/nivo-babel-preset/use-lodash-es.js @@ -0,0 +1,13 @@ +module.exports = function() { + return { + visitor: { + ImportDeclaration(path) { + var source = path.node.source + source.value = source.value.replace( + /^lodash($|\/)/, + 'lodash-es$1' + ) + }, + }, + } +}