-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Tweak UMD / global semantics #8678
Conversation
@@ -1923,6 +1923,10 @@ | |||
"category": "Error", | |||
"code": 2685 | |||
}, | |||
"Identifier '{0}' must be imported from a module": { |
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.
But that isn't specifically the solution. The problem is that you're using something intended to be used as a global. Importing an identifier by that name from a module might not work at all. Importing the module as that name would work.
A better message might be
The namespace '{0}' declared in '{1}' is not accessible within a module. Did you mean to import the file instead?
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.
We don't have a good way right now to generate {1}
in that message (since we'd basically have to reverse-engineer a module name that would successfully resolve from the containing file).
How about
Global identifier {0} cannot be used from a module. Did you mean to import this from its module?
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.
What about getting the path relative to the project root?
Still confusing, but better. 😄 |
Any other comments? |
Fixes #7843 |
The message is a bit vague, and can be enhanced, other than that 👍 |
The behavior for UMD declarations is now that you cannot use UMD symbols from external modules. This removes the confusing concept of "was this file referenced or not?".
I've also renamed
GlobalModuleExportDeclaration
toNamespaceExportDeclaration
because it was confusing.Fixes #8255