Closed ayuhito closed 11 months ago
It works based on these tests but you may have discovered an edge-case.
Thanks for the reproduction, will look into it
I have the same issue on my side,
On linux #!/usr/bin/env node
is injected in dist/my-cli.js
, not in cjs
or mjs
files
On Windows 10 Pro 22H2 (up to date) no hashbang in any files
So it seems related to OS only
Yup, I can confirm it is definitely a Windows only bug.
This is a current workaround I have for all my packages in the meantime which runs after every build.
I think the current version doesn't work to include the hashbang for any files included in the
bin
field ofpackage.json
. Or more accurately, I don't think the bundler even recognisesbin
field at all, considering thecli.ts
file is compiled to bothcli.js
andcli.mjs
when pkgroll is run, rather than justcli.js
with just the hashbang.Here's a simple repro, although there really isn't anything special to it. I've copied the instructions on the README which leads to this bug. The dist files are shown so you can see the result.
I wonder if #7 is related to this?