Skip to content

Build fails on version 1 due to failed resolution of expo-sqlite #12559

@jacobg

Description

@jacobg

Issue description

Build fails on version 1 due to failed resolution of expo-sqlite

Expected Behavior

After updating to typeorm version 1, expect npm run build of my application to succeed.

Actual Behavior

Build fails with this error, even though my app does not use expo. It uses capacitor.

error during build:
Build failed with 1 error:

Error: [vite]: Rolldown failed to resolve import "expo-sqlite" from "/Users/jacob/repositories/f-next/node_modules/typeorm/browser/driver/expo/ExpoDriver.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rolldownOptions.external`
    at viteLog (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33346:57)
    at onRollupLog (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33378:7)
    at onLog (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33146:4)
    at file:///Users/jacob/repositories/f-next/node_modules/rolldown/dist/shared/rolldown-build-CrPk_lZe.mjs:50:26
    at logger (file:///Users/jacob/repositories/f-next/node_modules/rolldown/dist/shared/rolldown-build-CrPk_lZe.mjs:41:3)
    at aggregateBindingErrorsIntoJsError (file:///Users/jacob/repositories/f-next/node_modules/rolldown/dist/shared/error-BuvQYXuZ.mjs:48:18)
    at unwrapBindingResult (file:///Users/jacob/repositories/f-next/node_modules/rolldown/dist/shared/error-BuvQYXuZ.mjs:18:128)
    at #build (file:///Users/jacob/repositories/f-next/node_modules/rolldown/dist/shared/rolldown-build-CrPk_lZe.mjs:3246:34)
    at async buildEnvironment (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33253:64)
    at async Object.build (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33675:19)
    at async Object.buildApp (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/chunks/node.js:33672:153)
    at async CAC.<anonymous> (file:///Users/jacob/repositories/f-next/node_modules/vite/dist/node/cli.js:777:3) {
  errors: [Getter/Setter]

I am able to work around and get build to work by adding to vite.config.ts:

rolldownOptions: {
   external: ['expo-sqlite']
}

But it doesn't seem that this should be necessary, given that my app doesn't use expo and no other drivers have this issue. It seems unintended.

Steps to reproduce

npm run build

My Environment

Dependency Version
Operating System
Node.js version x.y.zzz
Typescript version x.y.zzz
TypeORM version x.y.zzz

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • capacitor
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions