digital-loukoum / esrun

Simple wrapper around esbuild to execute a Typescript file
MIT License
173 stars 11 forks source link

import "zx/globals" on Windows is broken #46

Open malua opened 6 months ago

malua commented 6 months ago

Hey thanks for the package, although I found a another issue on Windows.

We are using zx to write scripts and the import "zx/globals" does not work on Windows.

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'REMOVED\node_modules\.bin\node_modules\zx\build\globals.js' imported from REMOVED\node_modules\.bin\esrun-1714738033084.tmp.mjs
Did you mean to import ../../zx/build/globals.js?
    at finalizeResolution (node:internal/modules/esm/resolve:264:11)
    at moduleResolve (node:internal/modules/esm/resolve:917:10)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///REMOVED/node_modules/.bin/node_modules/zx/build/globals.js'
}

It looks in node_modules\.bin\node_modules\zx\build\globals.js instead of just node_modules\zx\build\globals.js.

If you ever come around to fixing it, I would greatly appreciate it!