crootfast
Version:
大前端工程化命令行脚手架
117 lines (114 loc) • 2.87 kB
JavaScript
const path = require('path');
const webpackModuleFederationUrl = {
"0": "http://localhost:8081", // 修改为本地fui的ip和端口
"1": "" // http://localhost:18081 修改为线上的fui的ip和端口
}[+global["$isProduction"]];
module.exports = {
assetsPath: "autocode",
base: {
output: {
uniqueName: "<%productname%>UniqueApp"
},
alias: {
'@': getAppnamePath('/src'),
'@assets': getAppnamePath('/src/assets'),
'@coms': getAppnamePath('/src/components'),
'@common': getAppnamePath('/src/common'),
'@stores': getAppnamePath('/src/stores')
},
rules: [],
plugins: [],
mfp: [{
name: '<%productname%>', // arguments
remotes: {
'crootfui': `crootfui@${webpackModuleFederationUrl}/crootfui/fuiEntryIndex.js`
},
shared: {
// ...require('./package.json').dependencies,
react: {
eager: true,
singleton: true,
requiredVersion: '18.2.0'
},
'react-dom': {
eager: true,
singleton: true,
requiredVersion: '18.2.0'
},
'react-router-dom': {
eager: true,
singleton: true,
requiredVersion: '6.14.2'
}
}
}]
},
dev: {
server: "http",
open: false,
hot: !true,
port: "auto",
proxyTable: {
'/api/hub': {
target: 'http://172.20.101.65:15010',
// target: 'http://173.168.90.57:14010',
pathRewrite: {
'^/api/hub': '/api/rops/low-code'
},
secure: false,
changeOrigin: true
},
'/api/rops': {
target: 'http://172.20.101.65:15010',
// target: 'http://173.168.90.57:14010',
// pathRewrite: {
// '^/api/rops': '/api/rops'
// },
secure: false,
changeOrigin: true
},
'/api/web': {
target: 'http://127.0.0.1:8001',
secure: false,
changeOrigin: true
},
'/crootfui/**': {
target: 'http://127.0.0.1:8081',
secure: false,
changeOrigin: true
}
},
historyApiFallback: {
rewrites: [{ from: /.*/g, to: '/index.html' }],
},
rules: [{
test: /\.(jsx)$/,
enforce: "pre", // 确保代码被其他loader处理之前,先进行了ESLint检测。
use: [
{
loader: "lint-reactcode-loader",
options: {
hookPath: "@hooks/usePrimitiveState",
proxyMaxCount: 3,
stateMaxCount: 5
}
}
],
exclude: [
getAppnamePath("./node_modules"),
getAppnamePath("./src/common")
],
include: [
getAppnamePath("./src")
]
}],
plugins: []
},
pro: {
rules: [],
plugins: []
}
};
function getAppnamePath(name) {
return path.join(__dirname, name)
}