Skip to content
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

Ramda bundling issue as of 0.8.19 #605

Closed
rscharer opened this issue Dec 16, 2020 · 6 comments
Closed

Ramda bundling issue as of 0.8.19 #605

rscharer opened this issue Dec 16, 2020 · 6 comments

Comments

@rscharer
Copy link

rscharer commented Dec 16, 2020

I have an extremely basic use case of bundling a TS node project that makes use of Ramda's groupBy function to shape data coming back from Postgres:

import * as R from 'ramda';
...
const rowsBySubType = R.groupBy((row) => row.subscriptionType, rxCategoryMedResult.rows);

When I bundle the file using esbuild 0.8.18, it correctly generates a module reference in the resulting js file:

// node_modules/ramda/src/groupBy.js
var require_groupBy = __commonJS((exports2, module2) => ...etc

However when I bundle it using esbuild 0.8.19 or above, the require_groupBy section is missing entirely, leading to a reference error when groupBy is invoked. I honestly think it's odd that this hasn't been reported before given how common Ramda is, and maybe there's something weird in my setup that I'm not seeing, but I'm going to have to pin 0.8.18 until this is either addressed or somebody can explain what I'm doing wrong. Thanks!

@evanw
Copy link
Owner

evanw commented Dec 16, 2020

I'm unable to reproduce the issue. Here's what I tried:

// rambda-demo.mjs
import * as R from 'ramda';

const rows = [
  { subscriptionType: 'a', value: 1 },
  { subscriptionType: 'a', value: 2 },
  { subscriptionType: 'b', value: 3 },
  { subscriptionType: 'b', value: 4 },
];

const rowsBySubType = R.groupBy((row) => row.subscriptionType, rows);
console.log(rowsBySubType);

Both node rambda-demo.mjs and esbuild --bundle rambda-demo.mjs | node produce the same output and neither crashes. This is with esbuild version 0.8.23 (the latest version).

Since I can't reproduce it, it might be something more specific to your setup. Do you have a way for me to reproduce the issue? For example, are you able to share a code sample containing the issue?

@rscharer
Copy link
Author

rscharer commented Dec 16, 2020 via email

@rscharer
Copy link
Author

rscharer commented Dec 17, 2020 via email

@rscharer
Copy link
Author

Attaching test file:

ramda-test.zip

@rscharer
Copy link
Author

Sorry, I just re-read your comment and realize you yourself are using --bundle — in my case it's the addition of --platform=node that's causing it to fail.

@evanw
Copy link
Owner

evanw commented Dec 18, 2020

Thanks! I can reproduce the issue now. I’ll fix it in the next release.

@evanw evanw closed this as completed in c65a4cf Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants