@@ -34,7 +34,7 @@
|
||||
"dev:app-android": "uni -p app-android",
|
||||
"dev:app-ios": "uni -p app-ios",
|
||||
"dev:custom": "uni -p",
|
||||
"dev": "uni",
|
||||
"dev": "node --experimental-loader ./scripts/window-path-loader.js node_modules/@dcloudio/vite-plugin-uni/bin/uni.js",
|
||||
"dev:test": "uni --mode test",
|
||||
"dev:prod": "uni --mode production",
|
||||
"dev:h5": "uni",
|
||||
|
||||
29
scripts/window-path-loader.js
Normal file
29
scripts/window-path-loader.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// fix: https://github.com/unibest-tech/unibest/issues/219
|
||||
|
||||
// Windows path loader for Node.js ESM
|
||||
// This loader converts Windows absolute paths to file:// URLs
|
||||
|
||||
import { pathToFileURL } from 'node:url'
|
||||
|
||||
/**
|
||||
* Resolve hook for ESM loader
|
||||
* Converts Windows absolute paths to file:// URLs
|
||||
*/
|
||||
export function resolve(specifier, context, defaultResolve) {
|
||||
// Check if this is a Windows absolute path (starts with drive letter like C:)
|
||||
if (specifier.match(/^[a-z]:\\/i) || specifier.match(/^[a-z]:\//i)) {
|
||||
// Convert Windows path to file:// URL
|
||||
const fileUrl = pathToFileURL(specifier).href
|
||||
return defaultResolve(fileUrl, context, defaultResolve)
|
||||
}
|
||||
|
||||
// For all other specifiers, use the default resolve
|
||||
return defaultResolve(specifier, context, defaultResolve)
|
||||
}
|
||||
|
||||
/**
|
||||
* Load hook for ESM loader
|
||||
*/
|
||||
export function load(url, context, defaultLoad) {
|
||||
return defaultLoad(url, context, defaultLoad)
|
||||
}
|
||||
Reference in New Issue
Block a user