Skip to content

Bug: cookie-es should be listed as a dependency in @tanstack/router-core #5137

@gtg7784

Description

@gtg7784

Bug Report: cookie-es should be listed as a dependency in @tanstack/router-core

Description

When deploying applications that use @tanstack/router-core on AWS Amplify Hosting, the build fails because cookie-es is imported by the package but not listed as a dependency. This causes a runtime error in production environments.

Error Log

H3Error: Cannot find package '/var/task/node_modules/cookie-es/index.js' imported from /var/task/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js
at legacyMainResolve (node:internal/modules/esm/resolve:210:26)
...
cause: Error: Cannot find package '/var/task/node_modules/cookie-es/index.js' imported from /var/task/node_modules/@tanstack/router-core/dist/esm/ssr/headers.js

Environment

  • @tanstack/router-core version: Latest (via @tanstack/react-router@^1.131.36)
  • Deployment Platform: AWS Amplify Hosting
  • Node.js version: Node.js runtime in AWS Lambda

Reproduction Steps

  1. Create a new React app with TanStack Router
  2. Deploy to AWS Amplify Hosting
  3. The deployment fails with the above error

Current Workaround

Manually adding cookie-es as a dependency in the application's package.json:

{
  "dependencies": {
    "cookie-es": "^2.0.0"
  }
}

Expected Behavior

cookie-es should be listed as a dependency in @tanstack/router-core's package.json since the package imports it directly in /dist/esm/ssr/headers.js.

Additional Context

  • This issue was discovered while troubleshooting deployment failures on AWS Amplify
  • Adding the package to Vite's optimizeDeps.include may also be needed for some environments

Suggested Fix

Add cookie-es to the dependencies in @tanstack/router-core/package.json:

{
  "dependencies": {
    "cookie-es": "^2.0.0"
  }
}

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