S
SolidJS14mo ago
dion

Unable to find modules

Hey guys, new to solidjs and SSR frameworks in general. I'm testing out a solidstart template generated using a community tool called "Create JD app". This allows me to quickly spin up a boilerplate project similar to create-t3-app. The problem is that I'm facing this runtime error:
An error occured while server rendering /:

Cannot find module '@/server/auth' imported from '......../src/routes/api/auth/[...solidauth].ts'
An error occured while server rendering /:

Cannot find module '@/server/auth' imported from '......../src/routes/api/auth/[...solidauth].ts'
Doing a build results in the following error:
Error: [vite]: Rollup failed to resolve import "@/utils/trpc" from "........../src/root.tsx". This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Error: [vite]: Rollup failed to resolve import "@/utils/trpc" from "........../src/root.tsx". This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Here's my vite config file:
import solid from "solid-start/vite";
import { defineConfig } from "vite";
import vercel from "solid-start-vercel";

export default defineConfig(() => {
return {
plugins: [solid({ ssr: true, adapter: vercel({ edge: false }) })],
};
});
import solid from "solid-start/vite";
import { defineConfig } from "vite";
import vercel from "solid-start-vercel";

export default defineConfig(() => {
return {
plugins: [solid({ ssr: true, adapter: vercel({ edge: false }) })],
};
});
I would love to know what is happening, since there's no errors that are being thrown by my editor, not sure of where to start...
2 Replies
andi
andi14mo ago
seems to me like the import alias @ is not set up to point to the root of your project if you're not getting any errors in your editor then typescript is probably set up properly you can either use this to sync your vite paths to the typescript.json file: https://www.npmjs.com/package/vite-tsconfig-paths or do it yourself with adding something like this to your vite.config.ts:
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
}
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
}
dion
dionOP14mo ago
Damn, you’re absolutely right, how could i have missed this. Thank you so much.
Want results from more Discord servers?
Add your server