Skip to content

Commit 5f4fcfa

Browse files
fix(esbuild): remove all node: imports from glob script to keep support for Jest v26 (#5784)
* fix(esbuild): remove all node: imports from glob script * prettier
1 parent 5a82d01 commit 5f4fcfa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/esbuild/sys-node.ts

+9
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ async function sysNodeExternalBundles(opts: BuildOptions) {
9696
bundleExternal(opts, opts.output.devServerDir, cachedDir, 'ws.js'),
9797
]);
9898

99+
/**
100+
* Some of globs dependencies are using imports with a `node:` prefix which
101+
* is not supported by Jest v26. This is a workaround to remove the `node:`.
102+
* TODO(STENCIL-1323): remove once we deprecated Jest v26 support
103+
*/
104+
const globOutputPath = join(opts.output.sysNodeDir, 'glob.js');
105+
const glob = fs.readFileSync(globOutputPath, 'utf8');
106+
fs.writeFileSync(globOutputPath, glob.replace(/require\("node:/g, 'require("'));
107+
99108
// open-in-editor's visualstudio.vbs file
100109
// TODO(STENCIL-1052): remove once Rollup -> esbuild migration is complete
101110
const visualstudioVbsSrc = join(opts.nodeModulesDir, 'open-in-editor', 'lib', 'editors', 'visualstudio.vbs');

0 commit comments

Comments
 (0)