You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
When including Tabletop as an es6 module and using a build tool that bundles modules/assets like Webpack or ParcelJS, the compiled package ends up being way larger than it should be. The smallest example I can create clocks in at a whopping ~1.1 MB minified. This issue will also affect several popular frameworks like Create React App and Vue Cli since they use Webpack internally. The issue stems from using Request as a dependency for when Tabletop is used inside NodeJS.
Simple test case:
Install tabletop in an empty project:npm install tabletop
Create an index.js with a single line: import tabletop from "tabletop";
The offending code is here: https://github.com/jsoma/tabletop/blob/master/src/tabletop.js#L9
Despite the comment that says "Webpack will not include it" it still does. It's technically mostly the dependency chain in Request itself that causes the bloat. If you comment out this whole if statement, the compiled asset using the simple test case will drop to a much more reasonable ~10 KB (of course you can't use it in Node then).
How to fix:
I'm not sure the best way to fix this that satisfies all use cases. One idea would be to switch from using the Request package and instead use something like Axios which is fully compatible with Node https://github.com/axios/axios. I did a quick test by swapping axios for request in the require statement and it produced a bundle of ~26 KB. That's not a perfect fix since it's still bundling code that will never be used in the browser. But that's still 97% smaller than using Request. I can whip up a PR if you like, but thought someone else might have an even better idea.
The text was updated successfully, but these errors were encountered:
I can confirm that this is also happening for me. I'm using Parcel as my bundler, and the bundle size is around 1.2Mb. Tabletop is easy to use, but if the bundle size is that big, then is a big no for me at the moment. Which is a shame because I can't make it google-spreadsheet package to work with Parcel, and the other options are too involved. Would be really nice to get this fixed.
Sorry, forgot about this issue. It looks like the v3 feed api will start sunsetting at the end of May with a final cut off at Sept 30 2020 basically rendering Tabletop useless. I'm not sure a PR to fix this is really worth it at this point.
Issue:
When including Tabletop as an es6 module and using a build tool that bundles modules/assets like Webpack or ParcelJS, the compiled package ends up being way larger than it should be. The smallest example I can create clocks in at a whopping ~1.1 MB minified. This issue will also affect several popular frameworks like Create React App and Vue Cli since they use Webpack internally. The issue stems from using Request as a dependency for when Tabletop is used inside NodeJS.
Simple test case:
npm install tabletop
import tabletop from "tabletop";
Tested with:
Why this happens:
The offending code is here: https://github.com/jsoma/tabletop/blob/master/src/tabletop.js#L9
Despite the comment that says "Webpack will not include it" it still does. It's technically mostly the dependency chain in Request itself that causes the bloat. If you comment out this whole if statement, the compiled asset using the simple test case will drop to a much more reasonable ~10 KB (of course you can't use it in Node then).
How to fix:
I'm not sure the best way to fix this that satisfies all use cases. One idea would be to switch from using the Request package and instead use something like Axios which is fully compatible with Node https://github.com/axios/axios. I did a quick test by swapping axios for request in the require statement and it produced a bundle of ~26 KB. That's not a perfect fix since it's still bundling code that will never be used in the browser. But that's still 97% smaller than using Request. I can whip up a PR if you like, but thought someone else might have an even better idea.
The text was updated successfully, but these errors were encountered: