Commit 5339eb45 authored by 前端-许佳敏's avatar 前端-许佳敏

chore: 开启mfsu, 强化构建, 使用babel-import处理lodash

parent d68a1ee5
import { defineConfig } from 'umi';
import ExternalsAntd from './utils/external-antd';
import AntdDayjsWebpackPlugin from 'antd-dayjs-webpack-plugin'
// import LodashModuleReplacementPlugin from 'lodash-webpack-plugin'
export default defineConfig({
devtool: false,
externals: {
"react": 'React',
"react-dom": 'ReactDOM',
"@antv/g2": 'G2',
"@antv/data-set": 'DataSet',
bizcharts: 'BizCharts',
"lingxi-design-ui": 'LingXiUI',
// "@formily/antd-components": 'FormilyComponent',
"@lingxi-design/ui": 'LingxiDesignUI',
// 对antd的组件做一个远程映射
...ExternalsAntd
},
scripts: [
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/react.production.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/react-dom.production.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/g2.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/data-set.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/BizCharts.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/LingXiUI.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/antd.min.js',
// 'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/formily-component.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/lingxi-design-ui.min.js',
],
chainWebpack(config) {
config.plugin('antd-dayjs-webpack-plugin').use(AntdDayjsWebpackPlugin)
// config.plugin('lodash-webpack-plugin').use(LodashModuleReplacementPlugin)
config.module
.rule('svg')
.exclude.add(/pages/)
.end(); // 给内置的添加 exclude,这里根据自己的情况处理
config.module
.rule('svgr')
.test(/.svg$/)
.include.add(/pages/)
.end() // include 指定需要直接 svgr 的情况
.use('@svgr/webpack')
.loader(require.resolve('@svgr/webpack'));
}
})
......@@ -11,7 +11,8 @@ export default defineConfig({
"@antv/data-set": 'DataSet',
bizcharts: 'BizCharts',
"lingxi-design-ui": 'LingXiUI',
"@formily/antd-components": 'FormilyComponent',
// "@formily/antd-components": 'FormilyComponent',
"@lingxi-design/ui": 'LingxiDesignUI',
// 对antd的组件做一个远程映射
...ExternalsAntd
},
......@@ -23,13 +24,8 @@ export default defineConfig({
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/BizCharts.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/LingXiUI.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/antd.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/formily-component.min.js',
],
extraBabelPlugins: [
[
'transform-remove-console',
{ exclude: ['error', 'warn'] },
]
// 'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/formily-component.min.js',
'http://lingxi-frontend-prod.oss-cn-hangzhou.aliyuncs.com/static/js/lingxi-design-ui.min.js',
],
chainWebpack(config) {
config.plugin('antd-dayjs-webpack-plugin').use(AntdDayjsWebpackPlugin)
......
......@@ -42,7 +42,7 @@ const config: any = {
},
// layout: {},
esbuild: {},
// mfsu: {},
mfsu: {},
antd: {},
locale: {
antd: true,
......@@ -55,7 +55,7 @@ const config: any = {
},
routes,
extraBabelPlugins: [
['lodash'],
// ['lodash'],
[
'import',
{ libraryName: 'antd', libraryDirectory: 'es', style: true },
......@@ -68,6 +68,11 @@ const config: any = {
],
[
'import',
{ libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false },
'lodash',
],
[
'import',
{
libraryName: '@umijs/hooks',
libraryDirectory: 'lib',
......@@ -75,6 +80,10 @@ const config: any = {
},
'@umijs/hooks',
], // 将下划线转化关闭
[
'transform-remove-console',
{ exclude: ['error', 'warn'] },
],
],
history: {
type: 'browser', // 'brower' | 'hash'
......
......@@ -24,7 +24,7 @@ import asyncRoutes from '../router.config.json';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
/** process.env.NODE_ENV === "development" */
const isDev = true;
const isDev = false;
const homeRoute = {
path: `/memberCenter/home`,
name: 'home',
......@@ -33,7 +33,7 @@ const homeRoute = {
component: '@/pages/home',
};
// const routes = isDev ? [ homeRoute, marketingRoute, MemberRoute ] : asyncRoutes;
const routes = isDev ? [ marketingRoute ] : asyncRoutes;
const routes = isDev ? [ homeRoute, MemberRoute, marketingRoute ] : asyncRoutes;
const memberCenterRoute = {
path: '/memberCenter',
......
......@@ -18,8 +18,10 @@
"start:dev": "cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev",
"start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules",
"start": "yarn api && yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev",
"start": "yarn api && yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=4096 UMI_ENV=local umi dev",
"start-noApi": "yarn scripts:build && cross-env NODE_OPTIONS=--max_old_space_size=4096 UMI_ENV=local umi dev",
"build": "yarn api && yarn scripts:build && yarn build:clean",
"build-noApi": "yarn scripts:build && yarn build:clean",
"build:yxc": "yarn api && yarn scripts:build-yxc && umi bu ild",
"build:analyze": "cross-env NODE_OPTIONS=--max_old_space_size=16384 ANALYZE=1 UMI_ENV=prod umi build",
"build:dev": "pm2 start scripts/devServer.js",
......@@ -44,6 +46,7 @@
"start:study": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.1.207:8100 USE_ROUTE_CONFIG=false SOCKET_URL=ws://10.0.1.207:9400 yarn start",
"start:25": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.25:8100 USE_ROUTE_CONFIG=true SOCKET_URL=ws://10.0.0.25:9400 yarn start",
"start:v2": "cross-env PRO_ENV=v2 yarn start",
"start-noApi:v2": "cross-env PRO_ENV=v2 yarn start-noApi",
"start:v2Preview": "cross-env PRO_ENV=v2Preview yarn start",
"start:v2scm": "cross-env PRO_ENV=v2scm yarn start"
},
......
......@@ -7,7 +7,7 @@ import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { useLinkEnumEffect } from '@/components/NiceForm/linkages/linkEnum'
import { getManageCountryAreaGetTelCode } from '@/services/ManageV2Api'
import { postLogisticsReceiverAddressAgentAdd, postLogisticsReceiverAddressAgentUpdate } from '@/services/LogisticsV2Api'
import { getManageAreaAll } from '@/services/ManageV2Api/id8689'
import { getManageAreaAll } from '@/services/ManageV2Api'
import { message } from 'antd'
export interface AddressModalProps {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment