1 Star 0 Fork 1

martsforever-demo/template-plain-react-micro-sub-react

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.56 KB
一键复制 编辑 原始数据 按行查看 历史
martsforever 提交于 2024-01-23 11:10 . Revert "feat: clear files"
const path = require('path')
const resolve = filePath => path.resolve(__dirname, './', filePath)
const config = {
title: 'React子应用', // 单页面应用title
APP_NAME: 'PLAIN_SUB_REACT_APPLICATION', // 每个应用的唯一标识,没有格式限制,只能用下划线命名,因为最后会输出为一个变量名
publicPath: '/template-plain-react-micro-sub-react/', // 部署路径
}
module.exports = {
publicPath: config.publicPath,
outputDir: resolve('docs'),
lintOnSave: false,
devServer: {
port: '3122',
disableHostCheck: true, // 关闭主机检查,使微应用可以被 fetch
headers: {"Access-Control-Allow-Origin": "*",}, // 因为应用之间需要互相加载,本地联调的时候需要配置跨域
},
configureWebpack: {
output: {
library: `CustomApplication${config.APP_NAME}_[name]`, // 微应用的包名,这里与主应用中注册的微应用名称一致
libraryTarget: "umd", // 将你的 library 暴露为所有的模块定义下都可运行的方式
jsonpFunction: `webpackJsonp_${config.APP_NAME}_project_[name]`, // 按需加载相关,设置为 webpackJsonp_#{APP_NAME}_project 即可
},
externals: {
react: {
root: 'React',
commonjs: 'react',
commonjs2: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs: 'react-dom',
commonjs2: 'react-dom',
},
},
},
pages: {
index: {
entry: resolve('src/main'),
template: 'public/index.html',
filename: 'index.html',
title: config.title,
chunks: ['chunk-vendors', 'chunk-common', 'index'],
},
config: {
entry: resolve('src/config'),
template: 'public/index.html',
filename: 'config.html',
title: config.title,
chunks: ['chunk-vendors', 'chunk-common', 'config'],
},
},
chainWebpack(config) {
config.resolve.alias
.set('@', resolve('src'))
.set('src', resolve('src'))
// .set('plain-micro-application', 'plain-micro-application/src/index.ts')
config.plugins
.delete('prefetch-index')
.delete('preload-index')
.delete('prefetch-config')
.delete('preload-config')
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/martsforever-demo/template-plain-react-micro-sub-react.git
git@gitee.com:martsforever-demo/template-plain-react-micro-sub-react.git
martsforever-demo
template-plain-react-micro-sub-react
template-plain-react-micro-sub-react
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385