Getting `msg.match` is not a function when using Bun
richardguerre opened this issue Β· comments
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch astro-expressive-code@0.33.5
for the project I'm working on.
When running astro using Bun (i.e. bunx --bun astro dev
) inside a monorepo, I was getting the following error:
msg.match is not a function. (In 'msg.match(/ec\.config\.mjs.*(from|resolved id)/)', 'msg.match' is undefined)
Stack trace:
at <anonymous> (/path/to/project/node_modules/astro-expressive-code/dist/index.js:39:10)
I modified astro-expressive-code
as follows to ignore the error and let the astro dev server to start:
diff --git a/node_modules/astro-expressive-code/dist/index.js b/node_modules/astro-expressive-code/dist/index.js
index 741def3..98240ed 100644
--- a/node_modules/astro-expressive-code/dist/index.js
+++ b/node_modules/astro-expressive-code/dist/index.js
@@ -36,7 +36,6 @@ async function loadEcConfigFile(projectRootUrl) {
const msg = error instanceof Error ? error.message : error;
const code = error.code;
if (code === "ERR_MODULE_NOT_FOUND" || code === "ERR_LOAD_URL") {
- if (msg.match(/ec\.config\.mjs.*(imported from|resolved id)/))
continue;
}
throw new Error(
This issue body was partially generated by patch-package.
Thank you for your report! This has been fixed and a new version will be released after the weekend.
I just released this with Expressive Code v0.34.0. Thanks again!
I'll create a Starlight PR to bump the EC version there as well. The next Starlight release will probably be on Friday.