janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
241 stars 58 forks source link

Bundle size pretty big, since universal-url #126

Closed 243083df closed 1 year ago

243083df commented 3 years ago

Seems like url-polyfill must be used instead.

janhommes commented 3 years ago

mh, can you point me which file you mean? The polyfill itself?

the main file is quite alright, or not? https://unpkg.com/browse/odata@1.3.1/dist/umd/

243083df commented 3 years ago

File size is ok, but probles is that this is not all code, since it contains require("universal-url") and another requires. And when webpack try to build bundle, it connect every require with package including universal-url with tr46

janhommes commented 3 years ago

I see. Didn't think of webpack.

I guess I need to place everything inside o.polyfill.ts.

janhommes commented 3 years ago

The require calls are there to make it work in node.js if fetch or URL is not present. As said, did not think about webpack.

Just checked out this: https://stackoverflow.com/questions/34828722/how-can-i-make-webpack-skip-a-require

Maybe it is worth a try to use window.require?

janhommes commented 3 years ago

could you try this one if the require() calls are still picked up by webpack? https://www.npmjs.com/package/o.js/v/1.4.0-rc0

243083df commented 3 years ago

Still picked up :C