sql-js / sql-js/sql.js

How to extract version number from NPM module in 1.14.1 for CDN loading of WASM?

Aperta
#627 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
13.7k
Fork
1.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Up to version 1.13.0 I was extracting the version using code:

// Extract sql.js version (to enable use of CDN for loading associated WASM)
import sqlJsPkg from 'sql.js/package.json' with { type: 'json' };
const sql_js_version = sqlJsPkg.version;

I was using this in code built with Vite/Webpack bundlers in order to load the correct WASM version from a CDN at runtime.

However, this no longer works in 1.14.1 due to the new restrictions in package.json of adding:

	"exports": {
		".": {
			"browser": "./dist/sql-wasm-browser.js",
			"default": "./dist/sql-wasm.js"
		},
		"./dist/*": "./dist/*"
	},

It was never a great way for me to extract the version as "import... with {type: 'json'}" depends on support for ES2025 features.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Start by reading package.json, especially the exports map, and compare it with the issue's version import used by Vite and Webpack builds. Check how the package is published in 1.14.1 and how the CDN URL is assembled. Done means identifying a supported way to obtain the package version without relying on the unsupported import path or newer syntax.

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

Valutazione

Stack tecnologico
javascript, vite, wasm, webpack
Ambito
build-system, web-dev
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.