W
Wasp-lang2mo ago
bx2

[plugin:vite:import-analysis] Failed to resolve import "../../../../src/clientSetup" from "src/index

I am trying to use the experiment ts support instead of the Wasp's DSL. I followed the migration guide, and i am getting an error telling me that clientSetup does not exist?
16 Replies
kapa.ai
kapa.ai2mo ago
Hi @bx2. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing suggests that the file clientSetup in the src directory cannot be found. This could be due to a few reasons: 1. The file does not exist: Ensure that the clientSetup file is present in the src directory. 2. Incorrect import path: The import path might be incorrect. Make sure the relative path to the clientSetup file is correct. 3. Migration issues: If you've recently migrated from Wasp 0.11.X to Wasp 0.12.X, there might be some issues with the migration. The migration guide (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#migrating-your-project-to-the-new-structure) provides a detailed step-by-step process to manually migrate your project. It also includes a script to automatically rewrite the imports in your JS(X)/TS(X) source files. 4. TypeScript configuration: If you're using TypeScript, ensure that your TypeScript configuration is set up correctly. Wasp 0.12.0 has some changes in how TypeScript is configured (source (https://github.com/wasp-lang/wasp/issues/835)). If you've checked all of these and are still facing the issue, it might be a good idea to raise an issue on the Wasp Github page (https://github.com/wasp-lang/wasp/issues) for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @bx2, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
bx2
bx2OP2mo ago
If anyone else will encounter this issue (i think this is missing from the migration documentation): 1. If you are overwriting the root component via client, you have to:
app.client({
rootComponent: { import: 'App', from: '@src/App' },
setupFn: { importDefault: 'setup', from: '@src/clientSetup' },
});
app.client({
rootComponent: { import: 'App', from: '@src/App' },
setupFn: { importDefault: 'setup', from: '@src/clientSetup' },
});
Note that setupFn is ALWAYS required - it will not compile otherwise. You cannot pass in null, or anything other that the object that matches the ts-defined type. this also means that you will require an empty clientSetup file (it is not created automatically). this file can look like this:
export default function setup() {}
export default function setup() {}
with the above changes, the migration tutorial will work. I think that ideally, the setupFn would not be needed at all. @kapa.ai you can mark this one as solved.
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I'm glad to hear that your issue has been resolved! If you have any more questions or run into any other issues, feel free to ask. Happy coding with Wasp! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @bx2, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
yep you discovered a bug we are currently working to fix (cc: @sodic ) and we'll let you know when it's resolved
bx2
bx2OP2mo ago
@Vinny (@Wasp) it is weird though because even updating typescript types did not help here - granted i only took a few minutes to debug, but let me know if you will need any help or additional info.
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
I'm not sure I understand. Why would updating types help? The issue is that the TS configuration expects a clientSetupFn (it's required, instead of optional), which was a mistake on our end. We need to make it optional. Which you correctly discovered to be the issue.
bx2
bx2OP2mo ago
what i mean is that types in the appSpec.ts seem correctly set to optional? https://github.com/wasp-lang/wasp/blob/7ef2a34409d0fda9acdb4747934522bf8cf23ba2/waspc/packages/wasp-config/src/appSpec.ts#L199 I am perhaps missing something. I am new to Wasp's codebase.
GitHub
wasp/waspc/packages/wasp-config/src/appSpec.ts at 7ef2a34409d0fda9a...
The fastest way to develop full-stack web apps with React & Node.js. - wasp-lang/wasp
bx2
bx2OP2mo ago
perhaps there is something happening in the compiler. anyway, thanks for responding to this.
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
Ah ok I see what you mean. Yeah the issue must be at a different level. Besides that issue, how are you finding the TS configuration (over the DSL)? Is there anything you'd like to see added or changed?
bx2
bx2OP2mo ago
I’m still thinking about it. I just started with the ts-based config. I see a lot of potential benefits to just coding everything in JS/TS. I’ll keep you posted.
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
cool! much appreciated 🙂
Filip
Filip2mo ago
Thanks for the report. I expect to get the fix out today
bx2
bx2OP2mo ago
🍻
Filip
Filip2mo ago
Hey fellas, this issue is fixed with Wasp 0.15.1. Just pull the latest version:
curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s
curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s
@bx2 Thanks for reporting and for the patience!
Vinny (@Wasp)
Vinny (@Wasp)2mo ago
yay!
bx2
bx2OP2mo ago
epic! thanks!
Want results from more Discord servers?
Add your server