#Error when importing library
1 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Is this some client-server thing I'm not getting
Got a question? Head over to the #1007476603422527558 channel. It's our go-to spot for all your questions.
sorry wrong one
Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message.
can you add code or something
Well this is the file
import { z } from "zod";
import nspell from 'nspell'
import dictionary from 'dictionary-en'
import {
createTRPCRouter,
publicProcedure,
} from "~/server/api/trpc";
const spellcheck = nspell(Buffer.from(dictionary.aff), Buffer.from(dictionary.dic))
export const wordRouter = createTRPCRouter({
isWord: publicProcedure
.input(z.object({ word: z.string() }))
.query(({ input }) => {
return spellcheck.correct(input.word);
}),
});
It errors on the import of dictionary
But the thing is on a different page where it's being imported that doesn't happen
hmm, its likely a issue with the package compatibility with the latest version
it was last published 2 years ago...
the issue is that an import from another page works fine
but from my main page no
Oh, are you using middleware?
Are you importing the file which imports this specific package in the middleware?
No
But I'm using that trpc route in 2 different files
and in only one it works
are any of your routes edge runtime
No
The difference between them is one is server component and one is client
when I used .useQuery() for it on the client it worked fine
when i just fetched it on the server i get an error
Are yous ure you get the error in import, or do you get it with nspell or something?
I'm not sure but it only works when using server trpc