fix(desktop): Improve platform-specific import resolution

- Add support for additional allowed extensions in import resolver
- Update import priorities for electron and web platforms
- Remove unnecessary `@follow/` import condition

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-03-04 18:50:58 +08:00
parent 7382a03e0a
commit d0bd89b106
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 3 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export function createPlatformSpecificImportPlugin(platform: Platform): Plugin {
if (importer.includes("node_modules")) return null
const [path, query] = source.split("?")
if (path.startsWith(".") || path.startsWith("/") || path.includes("@follow/")) {
if (path.startsWith(".") || path.startsWith("/")) {
let priorities: string[] = []
switch (platform) {
case "electron": {
@ -28,12 +28,13 @@ export function createPlatformSpecificImportPlugin(platform: Platform): Plugin {
".electron.js",
".electron.jsx",
...sharedExts,
...allowExts,
]
break
}
case "web": {
priorities = [".web.ts", ".web.tsx", ".web.js", ".web.jsx", ...sharedExts]
priorities = [".web.ts", ".web.tsx", ".web.js", ".web.jsx", ...sharedExts, ...allowExts]
break
}