sql-js / sql-js/sql.js

Problems with browserify

Abierto
#187 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
JavaScript
Estrellas
13.7k
Forks
1.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
build-system, web-dev
Tipo de issue
Error
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.