solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Cannot start applications using sqlite3

Open Bramas opened this issue 3 years ago • 0 comments

Hi, First of all I really enjoyed testing solid-start! thanks for the hard work.

I was unable to build & start an application that is using sqlite3, nor better-sqlite3, and think it might affect other packages build with node-gyp maybe.

How to reproduce:

  • Take any example (I used typescript and SSR in my examples)
  • pnpm add sqlite3
  • add in the index.tsx file:
    import sqlite3 from 'sqlite3';
    const db = new sqlite3.Database(':memory:');
    
  • pnpm build -> weird warning such as "'mock-aws-s3' is imported by mock-aws-s3?commonjs-external, " and "Circular dependency:"
  • pnpm start -> error 'mock-aws-s3' not found

With better-sqlite3 (and yarn because pnpm does not want to add it in my WSL)

  • Take any example
  • yarn add better-sqlite3
  • add in the index.tsx file:
    import Database from 'better-sqlite3';
    const db = new Database('foobar.db', {});
    
  • yarn build -> no warning
  • yarn start -> error:
                      if (fileName !== __filename) {
                                       ^
ReferenceError: __filename is not defined in ES module scope

Bramas avatar Nov 26 '22 13:11 Bramas