Skip to content

Commit 4ca158b

Browse files
authored
Merge pull request #16365 from Microsoft/release-2.4_AddDynamicImportToPreprocess
[Release 2.4] add dynamic import to preprocess
2 parents 1360a98 + c74e2dc commit 4ca158b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/services/preProcess.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,16 @@ namespace ts {
9595
function tryConsumeImport(): boolean {
9696
let token = scanner.getToken();
9797
if (token === SyntaxKind.ImportKeyword) {
98-
9998
token = nextToken();
100-
if (token === SyntaxKind.StringLiteral) {
99+
if (token === SyntaxKind.OpenParenToken) {
100+
token = nextToken();
101+
if (token === SyntaxKind.StringLiteral) {
102+
// import("mod");
103+
recordModuleName();
104+
return true;
105+
}
106+
}
107+
else if (token === SyntaxKind.StringLiteral) {
101108
// import "mod";
102109
recordModuleName();
103110
return true;
@@ -297,7 +304,8 @@ namespace ts {
297304
// import * as NS from "mod"
298305
// import d, {a, b as B} from "mod"
299306
// import i = require("mod");
300-
//
307+
// import("mod");
308+
301309
// export * from "mod"
302310
// export {a as b} from "mod"
303311
// export import i = require("mod")

0 commit comments

Comments
 (0)