代码拉取完成,页面将自动刷新
同步操作将从 刘宏伟/mall-cook 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* @Description: What's this for
* @Autor: WangYuan
* @Date: 2021-05-19 10:53:33
* @LastEditors: WangYuan
* @LastEditTime: 2021-11-05 16:56:06
*/
const path = require('path')
const sftpUploader = require('sftp-uploader')
const productionGzipExtensions = ['js', 'css']
const CompressionWebpackPlugin = require('compression-webpack-plugin')
function resolve (dir) {
return path.join(__dirname, dir)
}
let envConfig = {}
if (process.env.TYPE == 'admin') {
console.log('admin 环境')
envConfig = {
outputDir: 'dist/admin',
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
chunks: ['chunk-vendors', 'chunk-common', 'index']
}
}
}
} else {
console.log('h5环境')
envConfig = {
outputDir: 'dist/h5',
pages: {
h5: {
entry: 'h5/main.js',
template: 'public/index.html',
filename: 'index.html',
chunks: ['chunk-vendors', 'chunk-common', 'h5']
}
}
}
}
module.exports = {
publicPath: './',
...envConfig,
configureWebpack: config => {
// CDN 加载依赖
config.externals = {
'element-ui': 'ELEMENT',
vue: 'Vue',
vant: 'Vant',
moment: 'moment'
}
// gzip 压缩
console.log('GZIP');
console.log(process.env.GZIP);
if (process.env.GZIP == 'true') {
console.log('执行GZIP')
config.plugins.push(
new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
)
}
},
chainWebpack: config => {
// 别名配置
config.resolve.alias
.set('components', resolve('src/components'))
.set('views', resolve('src/views'))
.set('@', resolve('src'))
// 定义全局scss变量
const oneOfsMap = config.module.rule('scss').oneOfs.store
oneOfsMap.forEach(item => {
item
.use('sass-resources-loader')
.loader('sass-resources-loader')
.options({
// 公用scss
resources: './src/scss/index.scss'
})
.end()
})
config.module
.rule('scss')
.oneOf('vue')
.use('px2rem-loader')
.loader('px2rem-loader')
.before('postcss-loader') // this makes it work.
.options({ remUnit: 37.5, remPrecision: 8 })
.end()
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。