1 Star 0 Fork 1

Student_cdx/vue2-compositionApi-ts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
乘风 提交于 2021-03-03 22:21 . feat:添加源码
/**
* @author chengfeng
* @version 1.0.0
*/
const argv = process.argv.splice(2)
// 打包体积分析插件
const BundleAnalyzerPlugin = argv.includes('--analyzer')
? [new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)()]
: []
const path = require('path')
const resolve = dir => path.join(__dirname, dir)
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/ts/' : '/',
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false, // 去掉.map文件
chainWebpack: config => {
// 修复HMR
config.resolve.symlinks(true)
// 添加别名
config.resolve.alias.set('@', resolve('src'))
if (process.env.NODE_ENV === 'production') {
config.plugin('compressionPlugin').use(
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: productionGzipExtensions,
threshold: 10240,
minRatio: 0.8,
deleteOriginalAssets: true
})
)
}
},
devServer: {
port: 8080,
open: true, // 自动打开网页
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: process.env.VUE_APP_BASE_URL,
changeOrigin: true,
ws: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
// '/api': {
// target: `http://localhost:3000`,
// changeOrigin: true,
// ws: true,
// pathRewrite: {
// '^/api': ''
// }
// }
}
},
// webpack config
configureWebpack: {
plugins: [...BundleAnalyzerPlugin],
externals: {
AMap: 'AMap' // 高德地图配置
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/student-cdx/vue2-compositionApi-ts.git
git@gitee.com:student-cdx/vue2-compositionApi-ts.git
student-cdx
vue2-compositionApi-ts
vue2-compositionApi-ts
master

搜索帮助