问题描述
uniapp H5打包部署到github后,下划线开头的一个文件_plugin-vue_export-helper
访问不到,网络请求显示404
解决办法
需要修改配置 vite.config.js文章来源:https://www.toymoban.com/news/detail-555867.html
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// eslint-disable-next-line no-control-regex
const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g;
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
export default defineConfig({
build: {
rollupOptions: {
output: {
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
sanitizeFileName(name) {
const match = DRIVE_LETTER_REGEX.exec(name);
const driveLetter = match ? match[0] : "";
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
return (
driveLetter +
name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, "")
);
},
},
},
},
});
参考文章文章来源地址https://www.toymoban.com/news/detail-555867.html
- Vite 部署后 _plugin-vue_export-helper 文件 404 问题
到了这里,关于uniapp:H5打包部署到github后文件`_plugin-vue_export-helper`访问不到的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!