-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Describe the bug
When you export images and videos from iPhone, all file extensions are all UPPER_CASE by default, e.g.: .JPG .PNG, .MOV.
While Vite default assetsInclude option are case-sensitive, and only allow lowercase file ext.
This means before changing the ext or modifying assetsInclude options, these media won't work in Vite.
I also checked the definition of file ext and some media ones, and I am not finding any specification
telling these files must use lowercase extensions (i.e Apple is wrong).
vite/packages/vite/src/node/constants.ts
Lines 172 to 174 in be2c3fa
| export const DEFAULT_ASSETS_RE = new RegExp( | |
| `\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`, | |
| ) |
Thus, this should be a bug, and I think a i flag shall be added here.
Reproduction
I think this is not needed as a only a i flag needs to be aded on a RegExp to fix this.
Steps to reproduce
Import any uppercase asset, you will get the following error msg:
[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .PNG file format, or if it's an asset, add "**/*.PNG" to assetsInclude in your configuration.
D:/cygwin64/home/ReWi/EmbedReWi/src/reference/images/STM32.PNG
