You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been building a vscode extension, for that, i required sqlite to be run on the client side. (im kinda new to this vscode extension dev)
Altho i had tried a lot of other stuff including running the nodesqlite3 and better-sqlite3 (im running it in macOs)
I have been facing similar problems across both libraries.
Some of the persistant errors have been :
Could not locate bindings file error: This runs on startup of the extension development host for the sqlite3 instance. (this is the first error i get on clean install without a rebuild)
Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 128 (The version against which the error i have been facing has been for 115, 127 and 132 all tried and rebuilt with different versions of node)
I am thinking of shifting towards sql.js(which also requires some amount of configuration) now as the last hope since this has taken me days of debugging.
Below are the similar error threads i have gone through to no avail :
//@ts-check
"use strict";
const path = require("path");
//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/
/** @type WebpackConfig */
const extensionConfig = {
target: "node", // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: "none", // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, "../dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
},
externals: {
vscode: "commonjs vscode", // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
// modules added here also need to be added in the .vscodeignore file
"better-sqlite3": "commonjs better-sqlite3",
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
},
],
},
],
},
devtool: "nosources-source-map",
infrastructureLogging: {
level: "log", // enables logging required for problem matchers
},
};
module.exports = [extensionConfig];
The text was updated successfully, but these errors were encountered:
These are not "errors". Both libraries, nodesqlite3 and better-sqlite3, rely on a native module wrapping SQLite, being a C project itself. In order to use those libraries, the loaded module must be compatible with the runtime which is used to load them. When loading such modules the NODE_MODULE_VERSION is used to check compatibility.
Rebuilding the mentioned libraries for NodeJS won't solve the reported "errors" as VS Code requires a module, compiled against its respective Electron runtime API version. So, if you really want to use such native modules, it's up to you, to setup some build process that either compiles all the required combinations of OS and Electron versions or bundle existing prebuilt binaries.
As VS Code internally is using @vscode/sqlite3, I would rather try to use this module instead of trying to ship an extension with a custom made native module. Especially because updates of VS Codes Electron runtime will break your extension.
Thanks @neoxpert
this explained a lot of things actually, which me and a few other devs at work(all relatively not that experienced) have been stuck on.
I saw one of the maintainer's of vscode (i think) suggest using sql.js so i figured if thats a good enough way
I have been building a vscode extension, for that, i required sqlite to be run on the client side. (im kinda new to this vscode extension dev)
Altho i had tried a lot of other stuff including running the nodesqlite3 and better-sqlite3 (im running it in macOs)
I have been facing similar problems across both libraries.
Some of the persistant errors have been :
I am thinking of shifting towards sql.js(which also requires some amount of configuration) now as the last hope since this has taken me days of debugging.
Below are the similar error threads i have gone through to no avail :
this is my package.json :
this is my webpack config :
The text was updated successfully, but these errors were encountered: