From fc6ae6863deae8880cfc9247aa19c8900f573259 Mon Sep 17 00:00:00 2001 From: Michael Leaney Date: Thu, 9 Nov 2017 21:51:03 +0800 Subject: [PATCH] perf: import only needed lodash functions (#14, @leahciMic) This module imports the entirety of Lodash which is very large. This results in large bundle sizes for anyone consuming this module. This PR imports only the merge function from Lodash. --- src/index.js | 2 +- templates/auth.store.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index d8fdf8eeb..b50020ee3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ const { resolve } = require('path') -const { merge } = require('lodash') +const merge = require('lodash/merge') export default async function module (moduleOptions) { // Apply defaults diff --git a/templates/auth.store.js b/templates/auth.store.js index 80f61d8b6..497ca32f2 100644 --- a/templates/auth.store.js +++ b/templates/auth.store.js @@ -1,6 +1,6 @@ import Cookie from 'cookie' import Cookies from 'js-cookie' -import { kebabCase } from 'lodash' +import kebabCase from 'lodash/kebabCase' const options = <%= serialize(options) %> const storageTokenName = kebabCase(options.storageTokenName)