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

Warn if someone loaded a module at the same path twice #1264

Closed
justinbmeyer opened this issue Sep 2, 2017 · 1 comment
Closed

Warn if someone loaded a module at the same path twice #1264

justinbmeyer opened this issue Sep 2, 2017 · 1 comment

Comments

@justinbmeyer
Copy link
Contributor

Today I had someone import models/todo and ./models/todo. This caused a situation where CanJS's real-time didn't seem to work. This was because one part of the page was using one Todo export and other was using a different Todo export. It took me a while to figure this was because there were two Todo types.

I'd like to propose warning someone if a file at a path has been loaded twice.

This can be done by keeping a side table storing paths to module names. If two modules are added to this table, we should warn.

This warning would have made the problem immediately obvious.

I think there are very few reasons the same module might want to be executed twice. I remember @matthewp talking about this. I don't think these cases are common enough where a warning wouldn't be helpful for a majority of users.

@matthewp
Copy link
Member

matthewp commented Sep 5, 2017

👍 seems reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants