ambitious-aqua
ambitious-aqua10mo ago

Production build giving error

Hello, I'm trying to host a refine app in AWS EC2. Did "npm run build" after setting 'outDir' to 'dist' in tsconfig.json as the 'refine start' script requires the build to be existing in the 'dist' folder. Set some path aliases ilike below n vite.config.js as Vite was throwing path unresolved errors: '@/config': './dist/src/config/index.js', '@/providers': './dist/src/providers/index.js', '@/components': './dist/src/components/index.js', '@/utilities': './dist/src/utilities/index.js', '@/enums': './dist/src/enums/index.js' After fixing all those kinds of errors, now Vite is showing errors like these: "Could not resolve "./index.module.css?used" from "dist/src/components/single-element-form/index.js"" Should I copy css files like these manually to the correct paths in the dist folder? Or is it supposed to be done automatically? Also, am I moving in the right path for deploying a Refine app for production? UPDATE: Build was successfully completed as I used 'copyfiles' to copy the css files. Now, when accessing the link given by Vite(http://localhost:4173/), the browser console is showing the below error and the page is blank: ' Uncaught TypeError: Failed to resolve module specifier "@/config". Relative references must start with either "/", "./", or "../". ' Can anyone please help me on this?
4 Replies
kapa.ai
kapa.ai10mo ago
Hi @mahesh_23383. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not contain specific details about deploying a Refine app on AWS EC2 or handling the specific errors you're encountering. However, I can suggest that you ensure all your dependencies are correctly installed and your paths are correctly set in your configuration files. Also, make sure that your build process correctly compiles and bundles all your assets, including CSS files. For more detailed guidance, I recommend checking out the Refine documentation (https://refine.dev/docs) and GitHub issues (https://github.com/refinedev/refine/issues) for similar problems and solutions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@1164676527963766786> kapa.ai is still learning and improving, please let us know how it did by reacting below
adverse-sapphire
adverse-sapphire10mo ago
Hello @mahesh_23383 I think you shouldn't have dist prefix in your paths. We have a working example here, you can check: tsconfig.json: https://github.com/refinedev/refine/blob/c8c0aa7373741b5c2e4398541e58568067fbb01e/examples/app-crm/tsconfig.json#L20 And in your vite.config.ts : https://github.com/refinedev/refine/blob/edb02d17ce3f9c5fbbef11df9e9058424220e1df/examples/app-crm/vite.config.ts#L3
GitHub
refine/examples/app-crm/tsconfig.json at c8c0aa7373741b5c2e4398541e...
Build your React-based CRUD applications, without constraints. 🌟 Star to support our work! - refinedev/refine
GitHub
refine/examples/app-crm/vite.config.ts at edb02d17ce3f9c5fbbef11df9...
Build your React-based CRUD applications, without constraints. 🌟 Star to support our work! - refinedev/refine
ambitious-aqua
ambitious-aqua10mo ago
Thank you! I'll check