Skip to content

Commit ba360cf

Browse files
committed
Make error message for dynamic imports when module is ES2015 more helpful
1 parent beb7fd8 commit ba360cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28103,7 +28103,7 @@ namespace ts {
2810328103

2810428104
function checkGrammarImportCallExpression(node: ImportCall): boolean {
2810528105
if (moduleKind === ModuleKind.ES2015) {
28106-
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules);
28106+
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules_Please_use_esnext_or_commonjs_as_module_compiler_option);
2810728107
}
2810828108

2810928109
if (node.typeArguments) {

src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@
895895
"category": "Error",
896896
"code": 1322
897897
},
898-
"Dynamic import cannot be used when targeting ECMAScript 2015 modules.": {
898+
"Dynamic import cannot be used when targeting ECMAScript 2015 modules. Please use 'esnext' or 'commonjs' as module compiler option.": {
899899
"category": "Error",
900900
"code": 1323
901901
},

0 commit comments

Comments
 (0)