瀏覽代碼

Fixes #2815: Remove `require` reference in `typescriptServices`

Alexandru Dima 3 年之前
父節點
當前提交
ad4a942460

+ 4 - 0
build/importTypescript.js

@@ -69,6 +69,10 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
 		/= require\("perf_hooks"\)/m,
 		'/* MONACOCHANGE */= {}/* END MONACOCHANGE */'
 	);
+	tsServices = tsServices.replace(
+		/typeof require === "function"/m,
+		'/* MONACOCHANGE */false/* END MONACOCHANGE */'
+	);
 
 	// Flag any new require calls (outside comments) so they can be corrected preemptively.
 	// To avoid missing cases (or using an even more complex regex), temporarily remove comments

+ 1 - 1
src/typescript/lib/typescriptServices-amd.js

@@ -3495,7 +3495,7 @@ var ts;
         }
     }
     function tryGetNodePerformanceHooks() {
-        if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof require === "function") {
+        if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) {
             try {
                 var performance_1;
                 var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;

+ 1 - 1
src/typescript/lib/typescriptServices.js

@@ -3495,7 +3495,7 @@ var ts;
         }
     }
     function tryGetNodePerformanceHooks() {
-        if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && typeof require === "function") {
+        if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) {
             try {
                 var performance_1;
                 var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver;