From 56e03926bd539e272fbeeefb5c6b893d6b6dc9ad Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Mon, 16 Apr 2018 22:01:34 +0800 Subject: [PATCH] fix: always transpile lib directory (#73) --- lib/webpack/createBaseConfig.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/webpack/createBaseConfig.js b/lib/webpack/createBaseConfig.js index 0ea83c411c..cd09e2749a 100644 --- a/lib/webpack/createBaseConfig.js +++ b/lib/webpack/createBaseConfig.js @@ -70,10 +70,18 @@ module.exports = function createBaseConfig ({ }) if (!siteConfig.evergreen) { + const libDir = path.join(__dirname, '..') config.module .rule('js') .test(/\.js$/) - .exclude.add(/node_modules/).end() + .exclude.add(filepath => { + // Always transpile lib directory + if (filepath.startsWith(libDir)) { + return false + } + // Don't transpile node_modules + return /node_modules/.test(filepath) + }).end() .use('buble-loader') .loader('buble-loader') .options({