Skip to content

Cloudflare build fails if NODE_ENV is not production #1713

@rmarscher

Description

@rmarscher

With the 07_cloudflare template, the build fails when NODE_ENV is not set to production.

To reproduce:

npm create waku@latest -- --template 07_cloudflare --product-name waku-project
cd waku-project
NODE_ENV=development npm run build

You should see the build fail with

"sqlite" is imported by "sqlite?commonjs-external", but could not be resolved – treating it as an external dependency.

and

Could not resolve "./node.js" from "node_modules/.pnpm/blake3-wasm@2.1.5/node_modules/blake3-wasm/esm/index.js"

in the logs.

This issue was discovered while working on adding Waku to create-cloudflare.

I think it stems from adding sqlite to optimizeDeps in PR #1633.

A workaround is to add NODE_ENV=production into the build script in package.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions