Vercel - Module not found: Can't resolve
On a new deployment I am getting a new error where I haven't changed anything at all in these files.
Here is the contents of my [trpc].ts
Failed to compile.
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/root.js' in '/vercel/path0/src/pages/api/trpc'
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/trpc.js' in '/vercel/path0/src/pages/api/trpc'
Failed to compile.
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/root.js' in '/vercel/path0/src/pages/api/trpc'
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/trpc.js' in '/vercel/path0/src/pages/api/trpc'
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { env } from "../../../env/server.mjs";
import { appRouter } from "../../../server/api/root.js";
import { createTRPCContext } from "../../../server/api/trpc.js";
// export API handler
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`
);
}
: undefined,
});
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { env } from "../../../env/server.mjs";
import { appRouter } from "../../../server/api/root.js";
import { createTRPCContext } from "../../../server/api/trpc.js";
// export API handler
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`
);
}
: undefined,
});
1 Reply
No one ran into this issue?