Skip to content

Commit

Permalink
fix(esbuild): remove all node: imports from glob script to keep sup…
Browse files Browse the repository at this point in the history
…port for Jest v26 (#5784)

* fix(esbuild): remove all node: imports from glob script

* prettier
  • Loading branch information
christian-bromann committed May 22, 2024
1 parent 5a82d01 commit 5f4fcfa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/esbuild/sys-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ async function sysNodeExternalBundles(opts: BuildOptions) {
bundleExternal(opts, opts.output.devServerDir, cachedDir, 'ws.js'),
]);

/**
* Some of globs dependencies are using imports with a `node:` prefix which
* is not supported by Jest v26. This is a workaround to remove the `node:`.
* TODO(STENCIL-1323): remove once we deprecated Jest v26 support
*/
const globOutputPath = join(opts.output.sysNodeDir, 'glob.js');
const glob = fs.readFileSync(globOutputPath, 'utf8');
fs.writeFileSync(globOutputPath, glob.replace(/require\("node:/g, 'require("'));

// open-in-editor's visualstudio.vbs file
// TODO(STENCIL-1052): remove once Rollup -> esbuild migration is complete
const visualstudioVbsSrc = join(opts.nodeModulesDir, 'open-in-editor', 'lib', 'editors', 'visualstudio.vbs');
Expand Down

0 comments on commit 5f4fcfa

Please sign in to comment.