You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue explores improving code integration error messages (errors we get in places where framework code integrates with the user code).
The other kind of error messages the framework code might report (errors in user code detected while building the framework code) are explored in #2247.
Have Wasp compiler detect incorrect ext import paths and report them in compile-time
Right now, after restructuring, there are quite some error messages that are not easy to decifer.
Not that it was perfect before, but some of them seem to have worsened (while maybe some other have improved?). Let's track some of them down here so we can look into fixing it.
If in Wasp we import JS path that doesn't exist, we get message from [ Server ] that is not very clear.
For example, for
[ Server ] src/routes/apis/index.ts(8,84): error TS2307: Cannot find module '../../../../../../src/foo.js' or its corresponding type declarations.
It is not clear at all from this what the cause of that error is, what is the source, where is that path wrongly used. It is not even very clear that that path is leading to this file belonging to user.
Similarly, this is what we get if foo.js exists but doesn't export { fooBarNamespace }:
[ Server ] src/routes/apis/index.ts(8,10): error TS2305: Module '"../../../../../../src/foo.js"' has no exported member 'fooBarNamespace'.
The text was updated successfully, but these errors were encountered:
Another one:
If in main.wasp we provide a path to server file, without .js extension, then that doesn't work, and error is something like:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/martin/git/wasp-lang/wasp/waspc/examples/todo-typescript/.wasp/out/server/dist/src/serverSetup' imported from /home/martin/git/wasp-lang/wasp/waspc/examples/todo-typescript/.wasp/out/server/dist/.wasp/out/server/src/middleware/globalMiddleware.js
[ Server!] at new NodeError (node:internal/errors:393:5)
[ Server!] at finalizeResolution (node:internal/modules/esm/resolve:323:11)
[ Server!] at moduleResolve (node:internal/modules/esm/resolve:916:10)
[ Server!] at defaultResolve (node:internal/modules/esm/resolve:1124:11)
[ Server!] at nextResolve (node:internal/modules/esm/loader:163:28)
[ Server!] at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
[ Server!] at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
[ Server!] at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
[ Server!] at link (node:internal/modules/esm/module_job:75:36) {
[ Server!] code: 'ERR_MODULE_NOT_FOUND'
[ Server!] }
Very hard to figure out! One solution to this might be just to allow server/ code to work without extensions in the imports, this would be the best solution, instead of fixing the actual error message.
Important
by @sodic
This issue explores improving code integration error messages (errors we get in places where framework code integrates with the user code).
The other kind of error messages the framework code might report (errors in user code detected while building the framework code) are explored in #2247.
Related:
tsconfig.json
when processing their code #2247wasp compile
#1718 (comment)Right now, after restructuring, there are quite some error messages that are not easy to decifer.
Not that it was perfect before, but some of them seem to have worsened (while maybe some other have improved?). Let's track some of them down here so we can look into fixing it.
If in Wasp we import JS path that doesn't exist, we get message from
[ Server ]
that is not very clear.For example, for
if
foo.js
doesn't exist, we getIt is not clear at all from this what the cause of that error is, what is the source, where is that path wrongly used. It is not even very clear that that path is leading to this file belonging to user.
Similarly, this is what we get if
foo.js
exists but doesn't export{ fooBarNamespace }
:The text was updated successfully, but these errors were encountered: