TypeError: Cannot set properties of undefined (setting 'exports')
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 13.7k
- 派生
- 1.1k
- PR 合并指标
- 30 天内没有已合并 PR
描述
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!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
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.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, vscode, wasm
- 领域
- database, desktop
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100