surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.09k stars 795 forks source link

Why survey.jquery.js is so big (6.54 MiB)? #3075

Closed stephane-klein closed 1 year ago

stephane-klein commented 3 years ago

Hi,

When I build survey-jquery in my survey-jquery-webpack-playground I see:

$ yarn build:js
yarn run v1.22.10
$ webpack --mode=production
Webpack Bundle Analyzer is started at http://127.0.0.1:8888
Use Ctrl+C to close it
Hash: f8b2894639b5cbdb3923
Version: webpack 4.46.0
Time: 1027ms
Built at: 10/07/2021 21:42:48
  Asset      Size  Chunks                    Chunk Names
main.js  1.43 MiB       0  [emitted]  [big]  main
Entrypoint main [big] = main.js
[0] ./node_modules/jquery/dist/jquery.js 282 KiB {0} [built]
[1] ./node_modules/survey-jquery/survey.jquery.js 6.54 MiB {0} [built]
[2] ./node_modules/css-loader/dist/runtime/api.js 2.46 KiB {0} [built]
[3] ./src/main.js 1.06 KiB {0} [built]
[4] ./node_modules/survey-jquery/survey.min.css 498 bytes {0} [built]
[5] ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js 6.67 KiB {0} [built]
[6] ./node_modules/css-loader/dist/cjs.js!./node_modules/survey-jquery/survey.min.css 23.4 KiB {0} [built]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  main.js (1.43 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (1.43 MiB)
      main.js

WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

Question: why survey.jquery.js 6.54 MiB is so big? 🤔

Best regards, Stéphane

stephane-klein commented 3 years ago

Do you have any idea why it ? @andrewtelnov @dmitrykurmanov

andrewtelnov commented 3 years ago

@stephane-klein It is with debug info. You can make it smaller by removing questions like matrices, in fact grids, and localizations files from entry files. SurveyJS is one of the most powerfull survey/form JavaScript library, if not the most.

Thank you, Andrew

stephane-klein commented 3 years ago

It is with debug info

@andrewtelnov how can I disable it?

You can make it smaller by removing questions like matrices, in fact grids, and localizations files from entry files.

I looked all around… but I have not found, can you show me the way?

SurveyJS is one of the most powerfull survey/form JavaScript library, if not the most.

Yes, I know, thanks 💪🤗

tsv2013 commented 3 years ago

@stephane-klein You can use minified version - survey.jquery.min.js

frimmy commented 1 year ago

related - survey-core is very large -- anyway to reduce the size?

andrewtelnov commented 1 year ago

Please use minimized version.

Thank you, Andrew

frimmy commented 1 year ago

thank you, @andrewtelnov . is the minified version available on npm? I'm using the react client.

dmitry-kurmanov commented 1 year ago

thank you, @andrewtelnov . is the minified version available on npm? I'm using the react client.

yes of course, you could find the minified version here https://unpkg.com/browse/survey-core/survey.core.min.js and here is the all package content: https://unpkg.com/browse/survey-core/

Thank you, Dmitry

frimmy commented 1 year ago

thank you, @andrewtelnov . is the minified version available on npm? I'm using the react client.

yes of course, you could find the minified version here https://unpkg.com/browse/survey-core/survey.core.min.js and here is the all package content: https://unpkg.com/browse/survey-core/

Thank you, Dmitry

@dmitrykurmanov This is not quite what I'm looking for since I'm bundling survey-js dependencies as part of a single-page web app.

For the npm registry, is there a minified version for use in node-based projects?

Currently, the survey-core dependency is over ~6 MBs. this combined with using survey-creator-core (5.46MB) + survey-creator-react and survey-react-ui (.5MB and 1.24MB) makes including these dependencies expensive from a bundling perspective.

tsv2013 commented 1 year ago

We extracted map files from unminified build results. For survey-jquery right now script became 2.5M, map file - 3.5M. This should help to some extent. If you need to reduce bundle size more, you can clone this repo and create a custom build.