chushih
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
const path = require('path')
|
||||
const TransformPages = require('uni-read-pages')
|
||||
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
const {
|
||||
webpack
|
||||
} = new TransformPages()
|
||||
module.exports = {
|
||||
transpileDependencies: ['uview-ui'],
|
||||
configureWebpack: {
|
||||
devServer: {
|
||||
// 调试时允许内网穿透,让外网的人访问到本地调试的H5页面
|
||||
disableHostCheck: true,
|
||||
host: "0.0.0.0",
|
||||
port: 8088, // 端口号
|
||||
https: false, // https:{type:Boolean}
|
||||
open: false, //配置自动启动浏览器
|
||||
// 配置多个代理
|
||||
// proxy: {
|
||||
// "/baseURL": {
|
||||
// target: "https://api.bytd.link/", // 要访问的接口域名
|
||||
// ws: true, // 是否启用websockets
|
||||
// changeOrigin: true, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
|
||||
// pathRewrite: {
|
||||
// "^/baseURL": "", //这里理解成用'/api'代替target里面的地址,比如我要调用'https://api.bytd.link/user/add',直接写'/api/user/add'即可
|
||||
// }
|
||||
// },
|
||||
// "/tacticURL": {
|
||||
// target: "https://strategy.bytd.link/",
|
||||
// pathRewrite: {
|
||||
// "^/tacticURL": ""
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
|
||||
const tfPages = new TransformPages({
|
||||
includes: ['path', 'name', 'meta', 'aliasPath']
|
||||
});
|
||||
return JSON.stringify(tfPages.routes)
|
||||
}, true)
|
||||
})
|
||||
],
|
||||
externals: {
|
||||
|
||||
}
|
||||
},
|
||||
chainWebpack: (config) => {
|
||||
// 配置路径
|
||||
// config.resolve.alias
|
||||
// .set('$css', resolve('/static/css'))
|
||||
// .set('$utils', resolve('/static/utils'))
|
||||
// 发行或运行时启用了压缩时会生效
|
||||
config.optimization.minimizer('terser').tap((args) => {
|
||||
const compress = args[0].terserOptions.compress
|
||||
// 非 App 平台移除 console 代码(包含所有 console 方法,如 log,debug,info...)
|
||||
compress.drop_console = false
|
||||
compress.pure_funcs = [
|
||||
'__f__', // App 平台 vue 移除日志代码
|
||||
//'console.log' // 可移除指定的 console 方法
|
||||
]
|
||||
return args
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user