-
Notifications
You must be signed in to change notification settings - Fork 760
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
Bundle size reduction #960
Comments
@advzr - thanks for the note. We are very close to releasing a brand new version of this library which handles almost everything you mention here. Our main dependency that remains here is still |
This needs to be a much higher priority, the size of this library is insanely large for what it provides. |
The current 3.X version is significantly smaller than 2.X. There's one dependency we're looking to see if we can replace, but it's not high on our priorities. As always, contributions are welcome. |
Without this issue resolved, migrating to 3.0 is not an option. |
There is a way to get rid of All you need to do is to mock // mock/js-yaml.js
export function safeLoad(body) {
return JSON.parse(body);
} And add alias to webpack's config: {
alias: {
'js-yaml': path.resolve('./mock/js-yaml'),
},
} And there you go! Bundle size now weighs ~200kb less. The only prerequisite to this workaround is to use only json spec or otherwise you may end up with parsing errors. |
Hello. First of all I would like to thank you for your work on the project. It makes a lot easier to communicate with backend.
Recently we started to use swagger-js for our widget service and what bothers me is the overall bundle size. Our service is installed on other websites that already have their own code, so every Kb counts. As far as I can see the big size is mainly because of these lib dependencies:
js-yaml
I understand that most probably this library is included to have universal code for browsers and node. But for those who use swagger-js only as a browser client that is 44Kb (according to webpack bundle analyser plugin) of unused gzipped code. That is greater than jQuery with its 30Kb.
lodash-compat
This version of lodash is discontinued, and if I already have
lodash
orlodash-es
, I end up with 2 versions of the same library.q
As for q there is already an issue where it is confirmed that there will be an opportunity to use own promise lib. That is great to hear.
It would be great if swagger-js started to use es6 modules. Then we could import different versions of swagger-js. Those who need the lib for universal code could import swagger with
js-yaml
, while others would take a version without it. Or maybe there could be another npm packageswagger-js-es
just like lodash does for those who want swagger-js withlodash-es
and promises frombabel-polyfill
for size reduction.The text was updated successfully, but these errors were encountered: