mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
Merge branch 'vue3' of https://github.com/WeBankFinTech/fes.js into vue3
This commit is contained in:
commit
9c9c463e5a
@ -28,6 +28,7 @@ export default function () {
|
||||
require.resolve('./plugins/features/extraBabelPresets'),
|
||||
require.resolve('./plugins/features/extraPostCSSPlugins'),
|
||||
require.resolve('./plugins/features/html'),
|
||||
require.resolve('./plugins/features/globalCSS'),
|
||||
require.resolve('./plugins/features/inlineLimit'),
|
||||
require.resolve('./plugins/features/lessLoader'),
|
||||
require.resolve('./plugins/features/mountElementId'),
|
||||
|
@ -2,9 +2,10 @@ import {
|
||||
winPath
|
||||
} from '@umijs/utils';
|
||||
|
||||
function getBabelOpts({
|
||||
function getBableOpts({
|
||||
cwd,
|
||||
targets,
|
||||
config,
|
||||
presetOpts
|
||||
}) {
|
||||
const presets = [
|
||||
@ -19,7 +20,8 @@ function getBabelOpts({
|
||||
},
|
||||
modules: false
|
||||
}
|
||||
]
|
||||
],
|
||||
...(config.extraBabelPresets || [])
|
||||
];
|
||||
const plugins = [
|
||||
require('@babel/plugin-proposal-export-default-from').default,
|
||||
@ -45,7 +47,8 @@ function getBabelOpts({
|
||||
importOpts.libraryName
|
||||
])
|
||||
: []),
|
||||
require.resolve('@vue/babel-plugin-jsx')
|
||||
require.resolve('@vue/babel-plugin-jsx'),
|
||||
...(config.extraBabelPresets || [])
|
||||
];
|
||||
return {
|
||||
babelrc: false,
|
||||
@ -62,6 +65,7 @@ function getBabelOpts({
|
||||
|
||||
export default async ({
|
||||
cwd,
|
||||
config,
|
||||
modifyBabelOpts,
|
||||
modifyBabelPresetOpts,
|
||||
targets
|
||||
@ -72,8 +76,9 @@ export default async ({
|
||||
if (modifyBabelPresetOpts) {
|
||||
presetOpts = await modifyBabelPresetOpts(presetOpts);
|
||||
}
|
||||
let babelOpts = getBabelOpts({
|
||||
let babelOpts = getBableOpts({
|
||||
cwd,
|
||||
config,
|
||||
presetOpts,
|
||||
targets
|
||||
});
|
||||
|
@ -157,6 +157,7 @@ export default async function getConfig({
|
||||
const { targets, browserslist } = getTargetsAndBrowsersList({ config });
|
||||
const babelOpts = await getBableOpts({
|
||||
cwd,
|
||||
config,
|
||||
modifyBabelOpts,
|
||||
modifyBabelPresetOpts,
|
||||
targets
|
||||
|
@ -0,0 +1,25 @@
|
||||
import { relative, join } from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
export default (api) => {
|
||||
const {
|
||||
paths,
|
||||
utils: { winPath }
|
||||
} = api;
|
||||
const { absSrcPath = '', absTmpPath = '' } = paths;
|
||||
const files = [
|
||||
'global.css',
|
||||
'global.less',
|
||||
'global.stylus'
|
||||
];
|
||||
const globalCSSFile = files
|
||||
.map(file => join(absSrcPath || '', file))
|
||||
.filter(file => existsSync(file))
|
||||
.slice(0, 1);
|
||||
|
||||
api.addEntryCodeAhead(
|
||||
() => `${globalCSSFile
|
||||
.map(file => `require('${winPath(relative(absTmpPath, file))}');`)
|
||||
.join('')}`
|
||||
);
|
||||
};
|
0
packages/fes-template/src/global.css
Normal file
0
packages/fes-template/src/global.css
Normal file
Loading…
x
Reference in New Issue
Block a user