Skip to content

Commit 5dfc4ed

Browse files
committed
fix: mutil compiler babel env invalid
1 parent eeeaeb7 commit 5dfc4ed

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/base.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,17 @@ class WebpackBaseBuilder extends Config {
588588

589589
createBabelLoader() {
590590
const loaderName = 'babel-loader';
591+
const options = { forceEnv: process.env.BABEL_ENV };
591592
const compile = this.config.compile || {};
592-
const config = compile.cache ? this.createCacheLoader(compile.cache, loaderName) : { loader: loaderName, options: {} };
593+
const configCacheOptions = this.utils.isObject(compile.cache) ? compile.cache : {};
594+
const cacheOptions = this.merge(options, configCacheOptions);
595+
const config = compile.cache ? this.createCacheLoader(cacheOptions, loaderName) : { loader: loaderName, options };
593596
// use project .babelrc
594597
if (fs.existsSync(this.projectBabelrc)) {
595598
return config;
596599
}
597600
// use default babelrc
598-
return this.merge(config, { options : this.babelConfig });
601+
return this.merge(config, this.merge(options, this.babelConfig));
599602
}
600603

601604
createCacheLoader(loaderOptions, name) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "easywebpack",
3-
"version": "4.9.0-rc.3",
3+
"version": "4.9.0-rc.4",
44
"description": "基于 Webpack 的前端构建工程化解决方案",
55
"keywords": [
66
"webpack",

0 commit comments

Comments
 (0)