Cannot set property 'exports' of undefined
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- electron, javascript, sqlite, wasm, webpack
- Domaine
- build-system, database, desktop
Piste de recherche
Start with the Webpack configuration and the require('sql.js') call, then inspect where initSqlJs fails before locateFile runs. Reproduce the error in the Electron renderer and compare the bundled module/export behavior; done means determining whether the configuration or sql.js causes the error and documenting a verified resolution.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I'm trying to get Sql.js working with TypeORM inside Electron as part of the renderer but I'm running into an error I don't know how to handle. I'm getting the error: TypeError: Cannot set property 'exports' of undefined. I'm not sure if this is a configuration issue on my end or if there's some sort of bug. It seems like the error happens somewhere in initSqlJs before it gets to locating the wasm binary.
My setup is as follows:
WebPack Config
module.exports = {
entry: {main: './main.ts'},
output: {/*Removed for brevity*/},
target: 'electron-renderer',
module: {/*Removed for brevity*/},
plugins: [
/*Other plugins removed for brevity*/
new Webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
result.request = result.request.replace(/typeorm/, "typeorm/browser");
}),
new Webpack.ProvidePlugin({
'window.SQL': 'sql.js/dist/sql-wasm.js'
}),
new CopyPlguin({
patterns: [
{from: './node_modules/sql.js/dist/sql-wasm.wasm'}
]
})
]
}
Main Code
const initSqlJs = require('sql.js');
const SQL = await initSqlJs({
locateFile: (file: any) => {
console.log(file); //This line is never printed
return `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.1.0/dist/${file}`}
});
var db = new SQL.Database();
- Langage dominant
- JavaScript
- Étoiles
- 13.7k
- Forks
- 1.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
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.
Autres issues de sql-js/sql.js
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
-
Add the WebWorker API docs Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Toutes les issues de sql-js/sql.js
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
avniproject/avni-client#2135 ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
bevyengine/bevy-website#2595 ·
-
ecosystem wording
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
matrix-org/matrix.org#3649 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
vadimdemedes/ink#1029 ·