N
Nuxt2y ago
dmarr

How does @server/utils work?

When I try to add a file server/utils/index.ts, I don't seem to be able to import with import { x } from @server/utils I get an error: Cannot find module '@server/utils'
6 Replies
dmarr
dmarrOP2y ago
Does ~/server/utils resolve to {srcDir}/server/utils ?
Cue
Cue2y ago
Yes
sigveh
sigveh2y ago
You forgot a / after @ in the path. @/server/utils
Cue
Cue2y ago
And it would be @/server/utils what @sigveh said 👆
dmarr
dmarrOP2y ago
what's the diff between ~ and @?
Cue
Cue2y ago
preference The following aliases resolve to the project root, use whichever floats your boat.
{
"~~": "/<rootDir>",
"@@": "/<rootDir>",
"~": "/<rootDir>",
"@": "/<rootDir>",
}
{
"~~": "/<rootDir>",
"@@": "/<rootDir>",
"~": "/<rootDir>",
"@": "/<rootDir>",
}
Want results from more Discord servers?
Add your server