digital-loukoum / esrun

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

Error when executing esrun through an npm script #24

Closed LukenSkyne closed 1 year ago

LukenSkyne commented 1 year ago

Description:

As the title mentions, I tried using esrun in the npm scripts section. Executing esrun from the shell works like a charm. In the following error output, notice how the path (P:CodingProjectsJSPlayground\n) is missing the backslashes, something related to escaping:

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^
> playground@1.0.0 start
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string,
or absolute path string. Received 'P:CodingProjectsJSPlayground\n' +
  'ode_modules.binesrun-clcxt0qmo0000tgfnb0ovcay8.tmp.mjs'
    at new NodeError (node:internal/errors:399:5)
    at createRequire (node:internal/modules/cjs/loader:1356:13)
    at file:///P:/Coding/Projects/JS/Playground/node_modules/.bin/esrun-clcxt0qmo0000tgfnb0ovcay8.tmp.mjs:3:17
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
  code: 'ERR_INVALID_ARG_VALUE'
}

Minimal reproduction steps:

Tested environments:

Windows 11 Pro

Node:

npm:

Gin-Quin commented 1 year ago

Alright, I think this is a bug on Windows only. Unfortunately I don't have Windows, but I think I spotted the bug.

Can you try again with the latest version (3.2.16)?

LukenSkyne commented 1 year ago

Yup, 3.2.16 resolves the issue, thanks a lot! ♥