Improve webpack bundling

Aperta
#2,608 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript

Direzione di ricerca

Inizia ispezionando lo script di build di webpack e gli entrypoint che producono content-helper/editor-sidebar.js e dashboard-widget.js. Confronta il modo in cui vengono raggruppati Smart Linking e il modulo Telemetry, quindi ricerca l’approccio esistente ai package in stile Gutenberg. Il lavoro è completato quando sono presenti bundle più piccoli e specifici per funzionalità, le funzionalità disabilitate non vengono caricate e l’avviso relativo alle dimensioni di webpack segnalato viene risolto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Maintenance & Fixes Refactoring wp-parsely

Is your feature request related to a problem?

After the introduction of the new Smart Linking interface, when building the project with webpack, we get a particular warning regarding the bundle size.

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  content-helper/editor-sidebar (249 KiB)
      content-helper/editor-sidebar.css
      content-helper/editor-sidebar.js
      content-helper/editor-sidebar-rtl.css
      content-helper/editor-sidebar.asset.php


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/

Describe the solution you'd like

Improve the resulting bundle. Ideally, we should be able to break each individual feature into its own bundle, and enqueue the JS file each time is needed. This would also prevent loading, for example, the Smart Linking JS code when this feature is actually disabled.

This might require breaking each individual feature into an individual package and have the build script take care of those, similarly with what Gutenberg core does with its components. But I would need to do a deeper research on how that works.

Describe alternatives you've considered

Another alternative would be looking into reducing the bundle size by avoiding repeated code. One good example is the Telemetry module that is used everywhere, and it's bundled with both the editor-sidebar.js and dashboard-widget.js for example. If we could externalize this module and use it without including it in the bundle, it would save some space in the final bundle, solving the warning.

Lingua principale
PHP
Stelle
67
Fork
38
Merge medio
1g 5h
PR unite (30g)
79

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Parsely/wp-parsely

Tutte le issue di Parsely/wp-parsely

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.