Skip to content

Bundle asset file in nextjs #1258

@zhm

Description

@zhm

I'm trying to "bundle" a little sqlite db with my app, but it fails in the build step with the Workflow SDK.

const SQLITE_URL = new URL("db.sqlite", import.meta.url);

// at runtime use it...

Nextjs turbopack seems to be OK with it. I see .next/server/assets/db.e8730435.sqlite on disk when I disable the workflow sdk.

> env-production next build --turbo

Discovering workflow directives 2926ms
Created steps bundle 600ms
Created intermediate workflow bundle 13ms
Creating webhook route
Creating manifest...
Created manifest with 27 steps, 24 workflows, and 0 classes 3ms
▲ Next.js 16.2.0-canary.73 (Turbopack)
- Cache Components enabled
- Experiments (use with caution):
  · staleTimes

  Creating an optimized production build ...

> Build error occurred
Error: Turbopack build failed with 1 errors:
./apps/web/app/.well-known/workflow/v1/step/route.js:112603:22
Module not found: Can't resolve 'db.sqlite'
  112602 | import path2 from "node:path";
> 112603 | var SQLITE_URL = new URL("db.sqlite", import.meta.url);
         |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

Labels

No labels
No 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