加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
martsforever 提交于 2024-11-15 15:37 . feat: upgrade vue-cli
const path = require('path');
const resolve = filePath => path.resolve(__dirname, './', filePath);
const { DefinePlugin } = require('webpack');
const globalComponentPrefix = 'custom';
// process.env.NODE_ENV = 'production'
const config = {
title: 'PLAIN DESIGN', // 单页面应用title
APP_NAME: 'PLAIN_DESIGN_APPLICATION', // 每个应用的唯一标识,没有格式限制,只能用下划线命名,因为最后会输出为一个变量名
publicPath: '/plain-design/', // 部署路径
};
module.exports = {
publicPath: config.publicPath,
devServer: {
port: '3379',
},
lintOnSave: false,
outputDir: resolve('docs'),
pages: {
index: {
entry: resolve('src/pages/index/main.tsx'),
template: 'public/index.html',
filename: 'index.html',
title: 'plain-design-new',
chunks: ['chunk-vendors', 'chunk-common', 'index'],
},
},
css: {
sourceMap: false,
loaderOptions: {
sass: {
additionalData: `$prefix:'${globalComponentPrefix}'; @import "src/packages/styles/global.import.scss";`
}
},
},
configureWebpack: {
plugins: [
new DefinePlugin({
ENV: JSON.stringify(config),
globalComponentPrefix: JSON.stringify(globalComponentPrefix),
APP_ENV: JSON.stringify(require(resolve(`src/pages/env/config/${process.env.APP_ENV || 'prod'}.js`)))
}),
]
},
chainWebpack(config) {
config.plugins
.delete('prefetch-index')
.delete('preload-index');
config
.plugin('html-index')
.tap((args) => {
args[0].chunksSortMode = 'manual';
return args;
});
config.resolve.alias
.set('@', resolve('src'))
.set('src', resolve('src'))
.set('plain-design', resolve('src/packages'))
// .set('@peryl/react-compose/src/index', resolve('abc'));
// .set('@peryl/react-compose', resolve('node_modules/@peryl/react-compose/src/index'));
if (process.env.NODE_ENV === 'development') {
// config.resolve.alias.set('react-dom', 'react-dom/cjs/react-dom.production.min');
}
config.plugins
.delete('prefetch-index')
.delete('preload-index');
},
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化