fix: babel plugin config error

This commit is contained in:
bac-joker 2021-03-07 10:40:12 +08:00
parent 9f519b6f42
commit 57e7717aa0
4 changed files with 11 additions and 7 deletions

View File

@ -112,6 +112,11 @@ function createContext(userConfig) {
} }
export const request = (url, data, options = {}) => { export const request = (url, data, options = {}) => {
if (typeof options === 'string') {
options = {
method: options
};
}
if (!currentRequestInstance) { if (!currentRequestInstance) {
currentRequestInstance = getRequestInstance(); currentRequestInstance = getRequestInstance();
} }

View File

@ -2,7 +2,7 @@ import {
winPath winPath
} from '@umijs/utils'; } from '@umijs/utils';
function getBableOpts({ function getBabelOpts({
cwd, cwd,
targets, targets,
config, config,
@ -48,7 +48,7 @@ function getBableOpts({
]) ])
: []), : []),
require.resolve('@vue/babel-plugin-jsx'), require.resolve('@vue/babel-plugin-jsx'),
...(config.extraBabelPresets || []) ...(config.extraBabelPlugins || [])
]; ];
return { return {
babelrc: false, babelrc: false,
@ -77,7 +77,7 @@ export default async ({
if (modifyBabelPresetOpts) { if (modifyBabelPresetOpts) {
presetOpts = await modifyBabelPresetOpts(presetOpts); presetOpts = await modifyBabelPresetOpts(presetOpts);
} }
let babelOpts = getBableOpts({ let babelOpts = getBabelOpts({
cwd, cwd,
config, config,
presetOpts, presetOpts,

View File

@ -3,7 +3,7 @@ import { existsSync } from 'fs';
import Config from 'webpack-chain'; import Config from 'webpack-chain';
import webpack from 'webpack'; import webpack from 'webpack';
import createCssWebpackConfig from './css'; import createCssWebpackConfig from './css';
import getBableOpts from './getBableOpts'; import getBabelOpts from './getBabelOpts';
import createVueWebpackConfig from './vue'; import createVueWebpackConfig from './vue';
import createDefineWebpackConfig from './define'; import createDefineWebpackConfig from './define';
import createMinimizerWebpackConfig from './minimizer'; import createMinimizerWebpackConfig from './minimizer';
@ -155,7 +155,7 @@ export default async function getConfig({
}); });
const { targets, browserslist } = getTargetsAndBrowsersList({ config }); const { targets, browserslist } = getTargetsAndBrowsersList({ config });
const babelOpts = await getBableOpts({ const babelOpts = await getBabelOpts({
cwd, cwd,
config, config,
modifyBabelOpts, modifyBabelOpts,

View File

@ -9,8 +9,7 @@ export default (api) => {
const { absSrcPath = '', absTmpPath = '' } = paths; const { absSrcPath = '', absTmpPath = '' } = paths;
const files = [ const files = [
'global.css', 'global.css',
'global.less', 'global.less'
'global.stylus'
]; ];
const globalCSSFile = files const globalCSSFile = files
.map(file => join(absSrcPath || '', file)) .map(file => join(absSrcPath || '', file))