Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ext import in Wasp file doesn't support importing from a folder via index.js and error message is bad #2325

Open
Martinsos opened this issue Oct 8, 2024 · 1 comment
Labels
dx shouldfix We should do/fix this at some point

Comments

@Martinsos
Copy link
Member

Related discord convo: https://discord.com/channels/686873244791210014/1291549944859066421/1293109502584815627 .

Our extension should have told you - hey this is not possible but it didn't. We are using a specific module resolution strategy called NodeNext which only allows explicit imports of the index.ts file and won't work for folder imports like the above.

So we don't support imports like

query getCourseTopics {
  fn: import { getCourseTopics } from "@src/server/queries",
  ...
}

but instead it has to be

query getCourseTopics {
  fn: import { getCourseTopics } from "@src/server/queries/index",
  ...
}

Question is, are happy with this? We might be, but in that case, we should make it clearer to the user that this is not allowed. User above had hard time figuring out this was the cause of the error he was getting is allegedly the error is this : Property 'topics' does not exist on type '{}' on the frontend which is far away from the real cause.

@Martinsos Martinsos added the shouldfix We should do/fix this at some point label Oct 8, 2024
@sodic
Copy link
Contributor

sodic commented Oct 10, 2024

Closely related to #2222 and #2224

@sodic sodic added the dx label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx shouldfix We should do/fix this at some point
Projects
None yet
Development

No branches or pull requests

2 participants