Skip to content

Commit

Permalink
fix: get config failed with UMI_ENV and .umirc.{UMI_ENV}.js (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored Oct 14, 2019
1 parent 0e641b5 commit 95d3ce7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/umi-core/src/registerBabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { join } from 'path';
import slash2 from 'slash2';

export default function(cwd, extraFiles = []) {
const umiEnv = process.env.UMI_ENV;
require('@babel/register')({
presets: [
require.resolve('@babel/preset-typescript'),
Expand All @@ -14,7 +15,12 @@ export default function(cwd, extraFiles = []) {
],
],
ignore: [/node_modules/],
only: [join(cwd, 'config'), join(cwd, '.umirc.js'), join(cwd, '.umirc.ts')]
only: [
join(cwd, 'config'),
join(cwd, '.umirc.js'),
join(cwd, '.umirc.ts'),
...(umiEnv ? [join(cwd, `.umirc.${umiEnv}.js`), join(cwd, `.umirc.${umiEnv}.ts`)] : []),
]
.concat(extraFiles)
.map(file => slash2(file)),
extensions: ['.es6', '.es', '.jsx', '.js', '.mjs', '.ts', '.tsx'],
Expand Down

0 comments on commit 95d3ce7

Please sign in to comment.