W
Wasp2y ago
Chris

[Solved] Server side relative import fails to find the file

I'm attempting to create utility style files for the server but unable to import them properly in the server files. Per the docs: https://wasp-lang.dev/docs/language/overview (has almost exactly what I'm attempting to do)
import { doSomeThing } from './serverUtils'
import { generateImage } from '../shared/chatActions'
import { doSomeThing } from './serverUtils'
import { generateImage } from '../shared/chatActions'
It's throwing an error:
Cannot find module '...../.wasp/out/server/dist/ext-src/serverUtils'
Cannot find module '...../.wasp/out/server/dist/ext-src/serverUtils'
https://github.com/Kikketer/StorAI/blob/5463f03fb3ff799dd1737f55a55d0b1ff4247246/src/server/actions.ts#L3-L3
Overview | Wasp
Wasp is a declarative language that recognizes web application-specific terms (e.g. page or route) as
GitHub
StorAI/actions.ts at 5463f03fb3ff799dd1737f55a55d0b1ff4247246 · Kik...
Wasp Hackathon entry for a dungeon crawl adventure - StorAI/actions.ts at 5463f03fb3ff799dd1737f55a55d0b1ff4247246 · Kikketer/StorAI
4 Replies
MEE6
MEE62y ago
Wohooo @Chris, you just became a Waspeteer level 1!
matijash
matijash2y ago
Can you try adding .js to the end of the import?
Chris
ChrisOP2y ago
That seemed to fix it, thank you. I guess I'm not used to the TS half and other fancy stuff we get/don't get with Node imports (last time I really worked in node we did require('...
Filip
Filip2y ago
Yeah, no worries, this part is pretty confusing. We're looking for ways to make it better though so hold tight!
Want results from more Discord servers?
Add your server