popcodeorg / popcodeorg/popcode

Stop using bower

Aperta
#1,442 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

Nessuno ha ancora preso questa issue.

code quality
Lingua principale
JavaScript
Stelle
191
Fork
143
Merge medio
4g 11h
PR unite (30g)
5

Descrizione

We currently use Bower to install the libraries that are available to project code, e.g. jQuery, lodash, etc. This is a good fit since Bower by default ships packages in the old “put a global variable on window” form, which is exactly what Popcode projects expect.

However, Bower itself discourages people from using it, so we should probably migrate away from it. Ideally, we could just install the same packages via npm and load the pre-built standalone script into the preview frame. But there’s no guarantee that’s possible—lodash, for instance, does not appear to ship with a pre-built standalone script in its npm package.

A couple of other options (all kind of complicated and not terribly appealing) come to mind:

  • Create a webpack entrypoint for each library, then load the desired ones directly from the preview frame using <script> tags. This has the advantage of maintaining the expected behavior associated with loading scripts the old-fashioned way
  • Bundle all the libraries as part of the preview support script, but have the preview expose only the ones that are enabled as properties on window. This might get tricky with evaluation order, but has the advantage of not creating a proliferation of webpack entrypoints, and avoids the possibly vexing task of capturing the right reference to a bundle entrypoint to use in the <script> tag

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.