sql-js / sql-js/sql.js

Problems with browserify

Offen
#187 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
13.7k
Forks
1.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This kind of environment selectors destroy browserify (code is shortened for brevity).

if (ENVIRONMENT_IS_NODE) {
  var nodeFS = require('fs');
  var nodePath = require('path');

Browserify resolves the require even if it's inside of the if. Because of this, a big piece of Node.js is Browserified and never used because the code never falls there.

This is a nonsense. Is there any simple workaround to solve this problem inside the library?

It's easy to separate the environment selection in two files, one with the browser part and another with the node part but that's not cool for packaging.

What do you think?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start by reproducing the Browserify build around the ENVIRONMENT_IS_NODE block and inspect how the require('fs') and require('path') calls are resolved. Define a packaging-compatible way to avoid bundling unused Node.js code, then verify that the browser build succeeds without that code.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
build-system, web-dev
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.