Open cfellin1 opened 5 years ago
Ahh, yeah, yuck. Would love to hear suggestions / get help on this one.
Hey @cfellin1, do you think that configuring webpack to use browserfs provided fs module fix this for your usecase?
https://github.com/jvilk/BrowserFS#using-with-browserify-and-webpack
This is because the client tries to load the swagger.json.gz file from disk -- I think it might be possible to use standard require statements here, based on the version requested? We might want to not gzip them in that case. Possibly we could allow importing only the specific versions, like import Client from 'kubernetes-client/1.15'
for example to help reduce the bundle size?
For now, I got a little further by load the spec from the client, which skips the fs operations.
const client = new Client()
await client.loadSpec()
fs is currently called in the swagger client constructor: https://github.com/godaddy/kubernetes-client/blob/master/lib/swagger-client.js#L106
This causes errors in browser and makes it very difficult to construct a browser-friendly swagger client.