TypeError: Cannot set properties of undefined (setting 'exports')
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, vscode, wasm
Research direction
Start with the initSqlJs call and the bundled stack trace in dist/extension.js, then reproduce the failure in the VS Code extension environment. Check whether initialization completes before constructing SQL.Database for an existing or new database. Done means both database paths initialize without the reported TypeError.
Written by the indexing model from the issue text.
Description
Hello 👋
I'm trying to use sql.js in my vscode extension. But getting this error:
"TypeError: Cannot set properties of undefined (setting 'exports')
at /Users/dan/Projects/sql-ext-vscode/dist/extension.js:292298:395
at new Promise (<anonymous>)
at initSqlJs (/Users/dan/Projects/sql-ext-vscode/dist/extension.js:292227:24)
at ChatHistoryDatabaseManager.initialize (/Users/dan/Projects/sql-ext-vscode/dist/extension.js:291937:52)
at activate (/Users/dan/Projects/sql-ext-vscode/dist/extension.js:68:25)
at async B0.n (file:///Users/dan/Soft/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:4447)
at async B0.m (file:///Users/dan/Soft/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:4410)
at async B0.l (file:///Users/dan/Soft/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:3866)"
My source code is
const SQL = await initSqlJs();
if (fs.existsSync(dbPath)) {
const fileBuffer = fs.readFileSync(dbPath);
this.db = new SQL.Database(fileBuffer);
} else {
this.db = new SQL.Database();
}
Maybe I'm doing something wrong?
Thank you!
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sql-js/sql.js
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·