Skip to content

Fix #16675: Better error message for dynamic import with ES2015 modules#23957

Merged
mhegazy merged 3 commits into
microsoft:masterfrom
paulkoerbitz:16675-better-error-message-for-dynamic-import
May 9, 2018
Merged

Fix #16675: Better error message for dynamic import with ES2015 modules#23957
mhegazy merged 3 commits into
microsoft:masterfrom
paulkoerbitz:16675-better-error-message-for-dynamic-import

Conversation

@paulkoerbitz
Copy link
Copy Markdown
Contributor

Fixes #16675. Following the suggestions in this ticket this PR improves the error message when users try to use dynamic imports while having ES2015 as module in the compiler options.

Comment thread src/compiler/diagnosticMessages.json Outdated
"code": 1322
},
"Dynamic import cannot be used when targeting ECMAScript 2015 modules.": {
"Dynamic import cannot be used when targeting ECMAScript 2015 modules. Please use 'esnext' or 'commonjs' as module compiler option.": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about Dynamic import is only supported when '--module' flag is 'commonjs' or esNext`.

@paulkoerbitz
Copy link
Copy Markdown
Contributor Author

I agree with the comments and have changed the error message.

@mhegazy mhegazy merged commit 9ea4d93 into microsoft:master May 9, 2018
@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented May 9, 2018

thanks!

@paulkoerbitz
Copy link
Copy Markdown
Contributor Author

Thanks for this fantastic project!

@paulkoerbitz paulkoerbitz deleted the 16675-better-error-message-for-dynamic-import branch May 21, 2018 21:26
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants