From 7b4eb7f839461490184abefd69ef8bf839c4c2dc Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Sun, 25 Mar 2018 18:17:55 +0200 Subject: [PATCH] fix(loader): Use lodash inside the loader directly Stop using webpack module rules inside the loader to get rid of the babel 500kb warning fix #786 --- lib/loader.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/loader.js b/lib/loader.js index 58f9fba6..0adcd82d 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -38,7 +38,8 @@ module.exports = function (source) { 'webpackConfig', 'htmlWebpackPlugin' ]; - return 'var _ = require(' + loaderUtils.stringifyRequest(this, require.resolve('lodash')) + ');' + + // Require !!lodash - using !! will disable all loaders (e.g. babel) + return 'var _ = require(' + loaderUtils.stringifyRequest(this, '!!' + require.resolve('lodash')) + ');' + 'module.exports = function (templateParams) {' + // Declare the template variables in the outer scope of the // lodash template to unwrap them