Skip to content
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

Revert "feat(docs): new SVG Icon Explorer" #10173

Merged
merged 1 commit into from Jul 23, 2021

Conversation

hawkeye64
Copy link
Member

Reverts #10140

  • Adds too much MB to vendor file

@hawkeye64 hawkeye64 merged commit 87ef05e into dev Jul 23, 2021
@hawkeye64 hawkeye64 deleted the revert-10140-v2/icon-explorer branch July 23, 2021 15:44
@yusufkandemir
Copy link
Member

@hawkeye64 Instead of:

importedIcons.value = Object.freeze(require('@quasar/extras/' + val.value + '/index.js'))

we could do

importedIcons.value = await import(
  /* webpackPreload: true */
  `@quasar/extras/${val.value}/index.js`
)

which imports the module asynchronously thus creating different chunk(s) which means no impact on the vendor chunk, because of import(). It also adds a preload hint because of webpackPreload: true, which means that these modules will be preloaded since they can be needed at any time when the user is on the SVG icon explorer page(since the user can trigger a module import when interacting with the dropdown), which will increase the performance.

Also, AFAIK we should use shallowRef instead of using a ref and dealing with Object.freeze(), and if I am not mistaken shallowRef will be even better compared to Object.freeze(), both in terms of code simplicity and performance.

So, if you ever have time to play around with the proposed solution and verify it works and performs better, I guess we can add this great feature back, and avoid wasting your previous efforts 🙃

@hawkeye64
Copy link
Member Author

@yusufkandemir Even after those changes, the vendor file is still near 12mb (11972kb). The original is 717 kb

image

@hawkeye64
Copy link
Member Author

Even tried this, but no chunk created.

      import(
        /* webpackChunkName: "svg-explorer" */
        /* webpackMode: "lazy" */
        '@quasar/extras/' + val.value + '/index.js'
      ).then(svgFile => {
        importedIcons.value = markRaw(svgFile)
      })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants