TryGhost / node-sqlite3

SQLite3 bindings for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I can't bundle project with this library

ariran5 opened this issue · comments

Issue Summary

I use esbuld for bundle my typescript nodejs project to single file for docker container, and sqlite3 has many bad dependencies. see here npm graph

My command for bundle

esbuild src/index.ts --bundle --platform=node --target=node21 --outdir=dist --format=esm --banner:js="import {createRequire} from 'node:module'; const require = createRequire(import.meta.url)"

use this command for testing basic typescript project + esbuild

================

sqlite3 has dependency "@mapbox/node-pre-gyp" and i see, this package has bad imports without filename

node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:86:21:
      86 │       return require('./' + command)(self, argvx, callback);

and aws imports without this dependencies

node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
      43 │     const AWSMock = require('mock-aws-s3');
      
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22:
      76 │   const AWS = require('aws-sdk');
      
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23:
      112 │   const nock = require('nock');

I Cant bundle this

Steps to Reproduce

  1. instasll esbuild, sqlite3 and typescript
  2. bundle project with command
esbuild src/index.ts --bundle --platform=node --target=node21 --outdir=dist --format=esm --banner:js="import {createRequire} from 'node:module'; const require = createRequire(import.meta.url)"

Version

5.1.6

Node.js Version

21

How did you install the library?

windows 11 x86

This was fixed in 605c7f9, there should be a RC release soon, and then full release after 🙂