bestkolobok / vue3-jsoneditor

https://bestkolobok.github.io/vue3-jsoneditor/
MIT License
49 stars 8 forks source link

The file size is large #16

Closed nineaiyu closed 1 week ago

nineaiyu commented 2 weeks ago

After packing, the file size is quite large. Is there any way to reduce the size of the packed file? image

bestkolobok commented 1 week ago

The size of the file selected in the screenshot cannot be reduced, because it is a third-party library svelte-jsoneditor that I use for the vue3-jsoneditor. At the same time, I tried to optimize the download as much as possible by dynamically importing dependencies where possible, for example, the querylanguages:

switch (languageId) {
            case 'javascript': {
              const {javascriptQueryLanguage} = await import('vanilla-jsoneditor');
              queryLanguagesBuffer[languageId] = javascriptQueryLanguage;
              break;
            }
            case 'lodash': {
              const {lodashQueryLanguage} = await import('vanilla-jsoneditor');
              queryLanguagesBuffer[languageId] = lodashQueryLanguage;
              break;
            }
            case 'jmespath': {
              const {jmespathQueryLanguage} = await import('vanilla-jsoneditor');
              queryLanguagesBuffer[languageId] = jmespathQueryLanguage;
              break;
            }
            default: {
              break;
            }
          }

Therefore, you can further optimize your application by tune the optimal split chanking in the Vite config

nineaiyu commented 1 week ago

Thank you 👍