Skip to content

Commit a82c017

Browse files
committed
Move global process polyfill into typescript.ts
1 parent 1331dd3 commit a82c017

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

example/scripts/typescript.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ import { create as createTypeScriptPlugins } from 'volar-service-typescript'
3131
import { type TextDocument } from 'vscode-languageserver-textdocument'
3232
import { URI } from 'vscode-uri'
3333

34+
globalThis.process = {
35+
cwd() {
36+
return '/'
37+
}
38+
} as NodeJS.Process
39+
3440
/**
3541
* Convert markdown content to a DOM node.
3642
*

example/typescript.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
<div class="buttons">
2323
<button id="format-button" type="button">Format</button>
2424
</div>
25-
<script>
26-
globalThis.process = {
27-
cwd() {
28-
return '/'
29-
}
30-
}
31-
</script>
3225
<script type="module" src="./scripts/typescript.ts"></script>
3326
</body>
3427
</html>

0 commit comments

Comments
 (0)