bytenode/bytenode

Compiling with a file pattern *.js does not work on Windows

Closed this issue · 2 comments

Hi! I'am trying out bytenode for the first time. But I got an issue on Windows when I try to compile with a file pattern *.js.

Environment

  • Windows 10
  • Windows CMD (not the Powershell)
  • node v20.11.1
  • bytenode 1.5.6

Compiling a single .js file works:

$ npx bytenode -c dist\index.js

Compiling explicit multiple .js files works too:

$ npx bytenode -c dist\index.js dist\Config.js

But when I try to compile with a pattern * .js it doesn't work:

$ npx bytenode -c dist\*.js
> Error: Cannot find file 'C:\path_to_my_project\dist\*.js'.

Doesn't work too:

  • npx bytenode -c dist/*.js
  • npx bytenode -c dist\\*.js
  • npx bytenode -c dist\\*\.js
  • npx bytenode -c "dist/*.js"
  • npx bytenode -c "dist\*.js"

When I run this in the Linux subsystem WSL it works:

$ wsl
$ npx bytenode -c dist/*.js

Unless we add a giant dependency like glob, your only solution to perform this task in Windows CMD is this syntax:

for /R %f in (*.js) do bytenode -c %f

Ok, good to know. Thanks for the script! It works on Windows.

I think I gonna write a custom script as a build script, that uses glob and makes it platform independent.

Yep, the glob package is 454 kB unpacked. But maybe you will find tiny-readdir-glob interesting - it is only 38.6 kB unpackaged. But I didn't test it now.