Package create-t3-app with vercel/pkg

Hi everyone,
I tried to package my create-t3-app with vercel/pkg.
However I cant get it to work correctly.
There is an open issue with vercel/pkg when using .mjs files. therefore i changed the next.confg.mjs and env.mjs to .js files. so far so good. However when starting the executable I get the follwoing error.
Listening on port 3000 url: http://localhost:3000
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@trpc/client' imported from /snapshot/myproject/.next/standalone/.next/server/pages/_app.js.....



I use the standalone option of next.js:
// next.config.js
...
output: 'standalone',
...


Settings relevant for pkg
"bin": "server.js",
  "pkg": {
    "options": [
      "experimental-modules"
    ],
    "assets": [
      ".next/**/*",
      "node_modules/**/*.*",
      "node_modules/.prisma/**/*",
      "node_modules/.prisma/client/*.node"
    ],
    "scripts": [
      ".next/dist/**/*.js"
    ],
    "targets": [
      "node18-macos-arm64"
    ],
    "outputPath": "src-tauri/binaries/app"
  }


For context I want to run the packaged next.js executable as a sidecar in tauri.
Was this page helpful?