Skip to content

Commit

Permalink
VSCode deps now all seem to ship esm
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Dec 23, 2023
1 parent aa6564f commit 8ab0083
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ async function build() {
const umdToElmPlugin = {
name: "umd2esm",
setup(build) {
build.onResolve(
{ filter: /^(vscode-.*|estree-walker|jsonc-parser)/ },
(args) => {
const pathUmdMay = require.resolve(args.path, {
paths: [args.resolveDir],
});
// Call twice the replace is to solve the problem of the path in Windows
const pathEsm = pathUmdMay
.replace("/umd/", "/esm/")
.replace("\\umd\\", "\\esm\\");
return { path: pathEsm };
},
);
build.onResolve({ filter: /^(estree-walker|jsonc-parser)/ }, (args) => {
const pathUmdMay = require.resolve(args.path, {
paths: [args.resolveDir],
});
// Call twice the replace is to solve the problem of the path in Windows
const pathEsm = pathUmdMay
.replace("/umd/", "/esm/")
.replace("\\umd\\", "\\esm\\");
return { path: pathEsm };
});
},
};

Expand Down Expand Up @@ -160,4 +157,7 @@ async function build() {
}
}

build().catch((err) => process.exit(1));
build().catch((err) => {
console.error("Build failed: ", err);
process.exit(1);
});

0 comments on commit 8ab0083

Please sign in to comment.