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
  • Loading branch information
khanhduy1407 committed Dec 2, 2024
1 parent 9faed73 commit bfb4f7e
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(RINDO-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(RINDO-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 bfb4f7e

Please sign in to comment.