Skip to content

Commit

Permalink
detect ESM from root package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Oct 3, 2024
1 parent 4a353c7 commit 0ce2f84
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 23 deletions.
222 changes: 201 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/test-web",
"version": "0.0.61",
"version": "0.0.62",
"scripts": {
"install-extensions": "npm i --prefix=fs-provider && npm i --prefix=sample",
"compile": "tsc -b ./ && npm run compile-fs-provider",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@types/minimist": "^1.2.5",
"@types/node": "^20.14.9",
"@types/tar-fs": "^2.0.4",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.7.0",
"eslint": "^9.11.1",
"@tony.ganchev/eslint-plugin-header": "^3.1.2",
Expand Down
6 changes: 6 additions & 0 deletions src/server/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ async function isESM(vsCodeDevLocation: string): Promise<boolean> {
try {
const packageJSON = await fs.readFile(path.join(vsCodeDevLocation, 'out', 'package.json'));
return JSON.parse(packageJSON.toString()).type === 'module';
} catch (e) {
// ignore
}
try {
const packageJSON = await fs.readFile(path.join(vsCodeDevLocation, 'package.json'));
return JSON.parse(packageJSON.toString()).type === 'module';
} catch (e) {
return false;
}
Expand Down

0 comments on commit 0ce2f84

Please sign in to comment.