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
feat(error message): Especifing error message when cross-boundary #12117
Conversation
As for tests I recall that there are tests that test that Meteor creates a project properly and so on, so I would look to those for inspiration on how to test this. |
The file When To avoid confusing developers, I think it should be more precise in when it uses this error instead of the default
Valid imports on any arch:
There are some situations where it isn't clear what the developer intended. |
For tests, you could add them to the modules self tests: https://github.com/meteor/meteor/blob/devel/tools/tests/modules.js Or add them to the The |
Hey @zodern, I've done some upgrades based on your comments, but I got stuck in how to make modules work inside modules-runtime. I wanted to make these newer implementations using modern javascript or even typescript. I've tried using module.exports and require, but it also did not work have you ever faced something like this? Bellow, there's the error message.
|
Unfortunately,
I think using the default message in this case sounds good. |
|
Yes, all es5 syntax should be fine. |
ci is green now :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Could not figure out why tests on the server fall on standard error while ones for clients fall on the new ones |
Made the tests work properly. On the client, it throws the correct error messages that were the focus of this PR would you like to add something @zodern? |
I think there are 3 things left from what we had previously discussed:
|
Now I think I got everything. the only thing that I'm thoughtful is the order of the validations: if(!(id.startsWith('.') || id.startsWith('/'))) {
throw err;
}
if (id.endsWith('client') || id.endsWith('server')) {
// We don't know for sure what client wants to do so throw standard error
throw err;
}
if (imports(id).from('node_modules')) {
// Problem with node modules
throw err;
} there I'm not sure if there was supposed to be an order (left this way because I think is more concise) |
I think it is almost ready. The order doesn't really matter for those checks. Checking if the path ends with
|
I've done this adjustment! and added some tests for the case that I've mentioned |
Relates to this #11378
TODO / For discussion: