Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not dynamically require "better_sqlite3.node" #1102

Closed
agamm opened this issue Nov 10, 2023 · 1 comment
Closed

Could not dynamically require "better_sqlite3.node" #1102

agamm opened this issue Nov 10, 2023 · 1 comment

Comments

@agamm
Copy link

agamm commented Nov 10, 2023

I'm trying to import better-sqlite3 but I have a problem when I try to use it with an electron app.

When I add this:
import Database from "better-sqlite3";

I get:

App threw an error during load
Error: Could not dynamically require "C:\Users\myuser\windev\project\build\better_sqlite3.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
    at ne (C:\Users\myuser\windev\project\.vite\build\main.js:1:526)
    at h (C:\Users\myuser\windev\project\.vite\build\main.js:1:3441)
    at new m (C:\Users\myuser\windev\project\.vite\build\main.js:3:12762)
    at Object.<anonymous> (C:\Users\myuser\windev\project\.vite\build\main.js:3:13759)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at loadApplicationPackage (C:\Users\myuser\windev\project\node_modules\electron\dist\resources\default_app.asar\main.js:121:16)

Using:

  • Node v20.9.0
  • Windows 11
  • electron (27.0.4) forge (6.4.2) with the vite plugin.

Anything I'm missing?

@mceachen
Copy link
Member

Please see #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants