-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with node shebang #109
Comments
rollup seems to not handle this on purpose: rollup/rollup#235 we use @jaredpalmer's own shebang plugin: https://github.com/palmerhq/tsdx/blob/71817a33628983ee8a3adb4d10e852b5895d7a00/src/createRollupConfig.ts#L12 so it should work... will just leave it to you two to figure it out |
👋 @sw-yx thanks for chiming in here I hadn't seen that issue in my searching! I'm thinking my project it might be a better route to build with I don't have enough experience with rollup to really dig in here. I did see this plugin which adds the shebang afterwards so that users don't have to add it themselves. I replaced the current one in Thanks again! |
Took a look into this. What's the desired output? A shebang in each bundle, or one in function processEntry(entry) {
if (entry) {
let contents = fs.readFileSync(entry, 'utf8');
let matches = contents.match(/^\s*(#!.*)/);
shebang = matches && matches[1] || false;
// new code:
if (!shebang) return;
contents = contents.replace(shebang, '')
fs.writeFileSync(entry, contents)
}
} not sure if there's a better way to do that, but it worked. on the flip side, it seems pretty easy to also automate it so they don't have to add their own. lemme know what'd be preferred and i can implement it Edit: dug into rollup's hooks more and realized there was a |
You just want it in the entry file that has it. Not in every one. |
Current Behavior
I could be doing something wrong here but creating a new "basic" project and adding the node shebang to
index.ts
and runningyarn build --target node
results in this error:Expected behavior
Should build without an error as far as I know.
Suggested solution(s)
Not quite sure where the issue lies here. Spent a bit of time digging around to see if maybe I could figure it out but wasn't very successful.
Additional context
Sample Repo
Your environment
The text was updated successfully, but these errors were encountered: