Open arve0 opened 2 years ago
Debugging, it seems like shouldCompile
returns false because ignoreNodeModules
is true
and cli.ts is inside global node_modules folder.
I added
console.dir({ filename, exts, matcher, ignoreNodeModules, shouldCompile: shouldCompile(filename, exts, matcher, ignoreNodeModules)})
in newLoader
file:line esbuild-register/dist/node.js:2249, which gives:
{
filename: '/Users/arve/.config/nvm/18.3.0/lib/node_modules/@arve0/esbuild-register-syntaxerror/cli.ts',
exts: [ '.js', '.jsx', '.ts', '.tsx', '.mjs' ],
matcher: null,
ignoreNodeModules: true,
shouldCompile: false
}
Setting option hookIgnoreNodeModules: false
resolves the issue. But unsure if "global installed = node_modules" is intended behavior or not.
Hi 👋 Thanks for esbuild-register 🙌 I get
SyntaxError: Cannot use import statement outside a module
when using esbuild-register for installed package.bin
in package.json points to entrypoint which has contents:cli.ts simply outputs package version:
When running cli as installed package, it fails with:
Reproduction:
When in package source folder, it does not fail: