Bug (with easy repro): error importing pre-existing SQLite file

Summary

When a pre-existing SQLite file is required in a brand new project, an error is thrown, even after updating the packager settings.

Steps to Reproduce

(optionally skip these steps and check out https://github.com/danbenn/expo-sqlite-bug)

Expo SDK: 31.0.0 (latest),
Expo CLI: 2.4.0 (latest)

Create a new project:

expo init sqlite-module-bug && cd sqlite-module-bug

Create an empty SQLite database:

cd assets && sqlite3 sample.db "create table verses(field1 int);"

Add this anywhere in your App.js:

const sampleDatabase = require('./assets/sample.db');

Update packager settings:

"assetBundlePatterns": [
  "assets/*"
],
"packagerOpts": {
  "assetExts": ["db"]
}

Run expo:

expo start

And you’ll get this error:

Unable to resolve "./assets/sample.db" from "App.js"

Can anyone else confirm that this is a bug?

1 Like

I’m also encountering exactly same bug. Any suggestions?

Hello @danbenn I found a workaround for this bug. Look here unable-to-load-obj-file-using-require for details. :slight_smile:

1 Like

SOLVED: Unable to load .obj file using require - #4 by michaldatberg

Glad things got resolved. Always love seeing the community come together and helping each other out!

Cheers,

Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.