From 021ba5a1e21582755a1fff9771d8a444ae4fb682 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Sat, 5 May 2018 21:26:03 +0100 Subject: [PATCH] feat: make babel-loader exclude configurable --- lib/builder/webpack/base.js | 6 ++---- lib/common/nuxt.config.js | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/builder/webpack/base.js b/lib/builder/webpack/base.js index 71239229e1..04d4713645 100644 --- a/lib/builder/webpack/base.js +++ b/lib/builder/webpack/base.js @@ -40,6 +40,7 @@ export default class WebpackBaseConfig { ] } + delete options.exclude return options } @@ -139,10 +140,7 @@ export default class WebpackBaseConfig { }, { test: /\.jsx?$/, - exclude: file => ( - /node_modules/.test(file) && - !/\.vue\.js/.test(file) - ), + exclude: this.options.build.babel.exclude, use: perfLoader.pool('js', { loader: 'babel-loader', options: this.getBabelOptions() diff --git a/lib/common/nuxt.config.js b/lib/common/nuxt.config.js index 2de998ad71..a2da29d2d0 100644 --- a/lib/common/nuxt.config.js +++ b/lib/common/nuxt.config.js @@ -61,7 +61,11 @@ export default { }, babel: { babelrc: false, - cacheDirectory: undefined + cacheDirectory: undefined, + exclude: file => ( + /node_modules/.test(file) && + !/\.vue\.js/.test(file) + ) }, vueLoader: {}, postcss: {},