isolated_vm module not found after running bun dev

Hi folks, I'm trying to create a custom block following the Forge documentation. Both bun install and bun dev apparently executes ok but when I try to access the builder at http://localhost:3000 an error is raised complaining the isolated_vm module is not found. I'm using bun 1.2.15 and node v22.16.0and everything is running inside a devcontainer to ensure a pristine development environment (I also tried the same steps without the devcontainer with the same results). Any ideas about what I'm missing or doing it wrong?
3 Replies
ericchaves
ericchavesOP3mo ago
I think I figured out the error. The webpack configuration for the builder is not excluding the isolated_vm from the frontend build. We need to insert config.externals.push("isolated-vm") before returning the webpack configuration, at line 64 of file apps/builder/next.config.mjs

webpack: (config, { isServer }) => {
if (isServer) {
// TODO: Remove once https://github.com/getsentry/sentry-javascript/issues/8105 is merged and sentry is upgraded
config.ignoreWarnings = [
{
message:
/require function is used in a way in which dependencies cannot be statically extracted/,
},
];
config.externals.push("isolated-vm"); // <-- ADD THIS TO FIX isolated_vm module not found error.
return config;
}
config.resolve.alias["minio"] = false;
config.resolve.alias["qrcode"] = false;
config.resolve.alias["isolated-vm"] = false;
return config;
},

webpack: (config, { isServer }) => {
if (isServer) {
// TODO: Remove once https://github.com/getsentry/sentry-javascript/issues/8105 is merged and sentry is upgraded
config.ignoreWarnings = [
{
message:
/require function is used in a way in which dependencies cannot be statically extracted/,
},
];
config.externals.push("isolated-vm"); // <-- ADD THIS TO FIX isolated_vm module not found error.
return config;
}
config.resolve.alias["minio"] = false;
config.resolve.alias["qrcode"] = false;
config.resolve.alias["isolated-vm"] = false;
return config;
},
Please let me known if I should report this on github issues?
Magick
Magick4w ago
I'm also getting the same error, and I tried your fix. But unfortunately it didnt help. I'm using bun 1.2.19
theervilha
theervilha4w ago
Setting node version to 20, deleting the folder node_modules and re-installing the libraries solved for me nvm use 20

Did you find this page helpful?