How to extract version number from NPM module in 1.14.1 for CDN loading of WASM?
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 13.7k
- Forks
- 1.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, vite, wasm, webpack
- Domaine
- build-system, web-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100