-
Notifications
You must be signed in to change notification settings - Fork 23
Convert to commonjs for Node #31
Comments
Hey @dmihal - we've been developing/testing tbtc.js with some of the latest versions of node (v13), which include native support for ES modules. I believe you still need a flag for the JSON artifacts to load - If you have Node v13, running |
That's probably fine for now since tBTC is still in beta. But long term, limiting the library to only work with an experimental flag will probably prevent a lot of developers from using the library. I've written a number of NPM libraries, I know how frustrating it is trying to get a library to play nicely with both Web/Babel & Node 😩 |
Oh, I agree @dmihal, it's a nightmare. Sourcemaps in particular are something that still scare me re: transpilation. I don't know so much about bundling, aside from the requirements varying between every system I've used (Next.js, create-react-app, webpack, the list goes on). That being said - we should be able to make this usable from the get-go. I think in the coming weeks we'll explore some approaches, and if you have any recommendations, please feel free to contribute them. 🙂 |
No current plans to convert away from ES modules here, so I dropped the tags in favor of an To elaborate a bit, the decision to use ES modules was rooted in the goals of running on recent versions of Node, working for modern browser versions, and not requiring babel, while still supporting a relatively modern development environment. This is why all typing is done in JSDoc rather than TypeScript, for example. The fact that node currently tucks this behind a flag is annoying, but note that if an npm package is marked as We're open to feedback on specific trip-ups folks have integrating here, and definitely open to convert back to standard CommonJS if the downsides prove too great. |
The library uses ES modules, which requires a transpiling with something like babel. Thus, this can't be used easily in Node.js.
The text was updated successfully, but these errors were encountered: