Skip to content

打包微信小程序的时候如何过滤static文件夹下的图片 #5793

@fcb123

Description

@fcb123

问题分类

uni-app

问题描述

项目采用npx degit dcloudio/uni-preset-vue#vite my-vue3-project开发,需要支持app和微信小程序,app中的图片直接使用src/static/images路径下的图片,而小程序的图片使用服务器上的图片资源,但打成微信小程序包的时候src/static/images中的图片会一同打到微信小程序中,在vite.config.js中配置过滤掉这些图片,无法生效

附加信息

rollupOptions: {
external: UNI_PLATFORM === 'mp-weixin' ? [/src/static/images/.*.(png|jpg|jpeg|gif|webp)$/] : []
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions