DenoDDeno
Powered by
@tekatren:tekatren.sk@
Denoβ€’12mo agoβ€’
6 replies
@tekatren:tekatren.sk

Uncaught (in promise) TypeError: Relative import path "@payloadcms/next/withPayload" not prefixed

Trying to deno-ify my payloadcms project, and I'm facing import issues related to deno.json.

{
    "name": "@project/backend",
    "exports": "./src",
    "tasks": {
        "build": "next build",
        "dev": "next dev",
        "devsafe": "rm -rf .next && next dev",
        "generate:importmap": "payload generate:importmap",
        "generate:types": "payload generate:types",
    },
    "imports": {
        "@payloadcms/next": "npm:@payloadcms/next@3.31.0/",
        "@payloadcms/payload-cloud": "npm:@payloadcms/payload-cloud@3.31.0",
        "@payloadcms/richtext-lexical": "npm:@payloadcms/richtext-lexical@3.31.0",
        "cross-env": "npm:cross-env@^7.0.3",
        "graphql": "npm:graphql@^16.8.1",
        "next": "npm:next@15.2.3",
        "payload": "npm:payload@3.31.0",
        //...
    }
}
{
    "name": "@project/backend",
    "exports": "./src",
    "tasks": {
        "build": "next build",
        "dev": "next dev",
        "devsafe": "rm -rf .next && next dev",
        "generate:importmap": "payload generate:importmap",
        "generate:types": "payload generate:types",
    },
    "imports": {
        "@payloadcms/next": "npm:@payloadcms/next@3.31.0/",
        "@payloadcms/payload-cloud": "npm:@payloadcms/payload-cloud@3.31.0",
        "@payloadcms/richtext-lexical": "npm:@payloadcms/richtext-lexical@3.31.0",
        "cross-env": "npm:cross-env@^7.0.3",
        "graphql": "npm:graphql@^16.8.1",
        "next": "npm:next@15.2.3",
        "payload": "npm:payload@3.31.0",
        //...
    }
}

And the default template project does:
next.config.mjs
next.config.mjs

import { withPayload } from "@payloadcms/next/withPayload";

const nextConfig = {
  // Your Next.js config here
};
export default withPayload(nextConfig, { devBundleServerPackages: false });
import { withPayload } from "@payloadcms/next/withPayload";

const nextConfig = {
  // Your Next.js config here
};
export default withPayload(nextConfig, { devBundleServerPackages: false });


Error:
Task dev next dev
error: Uncaught (in promise) TypeError: Relative import path "@payloadcms/next/withPayload" not prefixed with / or ./ or ../
  hint: If you want to use a JSR or npm package, try running `deno add npm:@payloadcms/next/withPayload`
    at file:///home/djkato/data/Code/backend/next.config.mjs:1:29
    at async loadConfig (file://...dist/server/config.js:964:36)
    at async getStartServerInfo (file:///.../next/15.2.3/dist/server/lib/app-info-log.js:95:5)
    at async ServerImpl.<anonymous> (file:///.../next/15.2.3/dist/server/lib/start-server.js:232:41)
Task dev next dev
error: Uncaught (in promise) TypeError: Relative import path "@payloadcms/next/withPayload" not prefixed with / or ./ or ../
  hint: If you want to use a JSR or npm package, try running `deno add npm:@payloadcms/next/withPayload`
    at file:///home/djkato/data/Code/backend/next.config.mjs:1:29
    at async loadConfig (file://...dist/server/config.js:964:36)
    at async getStartServerInfo (file:///.../next/15.2.3/dist/server/lib/app-info-log.js:95:5)
    at async ServerImpl.<anonymous> (file:///.../next/15.2.3/dist/server/lib/start-server.js:232:41)


I assume this is something to do with import/importMaps but I tried different combinations and it's failing still.
How do I fix this?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Relative import path "ioredis" not prefixed with / or ./ or ../
bajosiBbajosi / help
3y ago
Relative import path "oak/router" not prefixed with / or ./ or ../ and not in import map
zingZzing / help
15mo ago
'Relative import path not prefixed' error from @types/express .d.ts file?
rally25rsRrally25rs / help
3y ago
Relative import path "events" not prefixed with / or ./ or ../ and not in import map from "https://e
LaraLLara / help
2y ago