--- quickjs-libc.c	2021-06-11 22:42:15.729357600 +0800
+++ patched.c	2021-06-11 22:44:01.426073100 +0800
@@ -511,6 +511,18 @@
 }
 #endif /* !_WIN32 */
 
+#if defined(_WIN32)
+static char *realpath(const char *path, char *buf)
+{
+    if (!_fullpath(buf, path, PATH_MAX)) {
+        errno = ENOENT;
+        return NULL;
+    } else {
+        return buf;
+    }
+}
+#endif
+
 int js_module_set_import_meta(JSContext *ctx, JSValueConst func_val,
                               JS_BOOL use_realpath, JS_BOOL is_main)
 {
@@ -530,7 +542,7 @@
         return -1;
     if (!strchr(module_name, ':')) {
         strcpy(buf, "file://");
-#if !defined(_WIN32)
+//#if !defined(_WIN32)
         /* realpath() cannot be used with modules compiled with qjsc
            because the corresponding module source code is not
            necessarily present */
@@ -542,7 +554,7 @@
                 return -1;
             }
         } else
-#endif
+//#endif
         {
             pstrcat(buf, sizeof(buf), module_name);
         }
@@ -2638,18 +2650,6 @@
     return JS_NewInt32(ctx, ret);
 }
 
-#if defined(_WIN32)
-static char *realpath(const char *path, char *buf)
-{
-    if (!_fullpath(buf, path, PATH_MAX)) {
-        errno = ENOENT;
-        return NULL;
-    } else {
-        return buf;
-    }
-}
-#endif
-
 /* return [path, errorcode] */
 static JSValue js_os_realpath(JSContext *ctx, JSValueConst this_val,
                               int argc, JSValueConst *argv)
