Commit abd9c153 by Sweet Zhang

增加vite配置文件

parent 0088031f
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"id": "vcode-input",
"name": "验证码输入框",
"version": "2.0",
"description": "验证码输入框,密码输入框",
"keywords": [
"验证码输入框",
"支付密码输入框"
],
"displayName": "验证码输入框",
"dcloudext": {
"category": [
"前端组件",
"通用组件"
]
},
"dependencies": { "dependencies": {
"@dcloudio/uni-ui": "^1.5.11", "@dcloudio/uni-ui": "^1.5.11",
"@uqrcode/js": "^4.0.7", "@uqrcode/js": "^4.0.7",
...@@ -29,7 +14,6 @@ ...@@ -29,7 +14,6 @@
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"qrcodejs2": "^0.0.2", "qrcodejs2": "^0.0.2",
"uqrcodejs": "^4.0.7", "uqrcodejs": "^4.0.7",
"vite-plugin-top-level-await": "^1.6.0",
"weixin-js-sdk": "^1.6.5" "weixin-js-sdk": "^1.6.5"
}, },
"devDependencies": { "devDependencies": {
......
// vite.config.js
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
// 自定义插件:移除 CSS 中的 shadow-grey.png 引用
function removeShadowGrey() {
return {
name: 'remove-shadow-grey',
transform(code, id) {
// 只处理 CSS 和 Vue 文件(含 <style>)
if (id.endsWith('.css') || id.endsWith('.scss') || id.endsWith('.vue')) {
// 将 url(...) 中包含 shadow-grey.png 的替换为 none
const newCode = code.replace(
/url\([^)]*shadow-grey\.png[^)]*\)/g,
'none' // 或 '""' 或 '#000',可根据需要调整
)
if (newCode !== code) {
return { code: newCode, map: null }
}
}
return null // 不处理其他文件
}
}
}
export default defineConfig({
plugins: [
uni(),
removeShadowGrey() // 加入自定义插件
],
build: {
cssCodeSplit: true
// 不再配置 rollupOptions.output.manualChunks,使用 Vite 默认分包策略
}
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment