You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux laptop 6.14.0-29-generic #29~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Aug 14 16:52:50 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
But not related to the problem, any platform
constvm=require("vm");(async()=>{constmodule=newvm.SourceTextModule("console.log('Works')",{initializeImportMeta(meta){// Note: this object is created in the top context. As such,// Object.getPrototypeOf(import.meta.prop) points to the// Object.prototype in the top context rather than that in// the contextified object.meta.prop={};}});// Works fine with 24.7.0, broken with 24.8.0if(module.instantiate)module.instantiate();awaitmodule.link(()=>{});awaitmodule.evaluate();})();
Not sure if this is expected or not? I known instantiate is not in official API, but we have tests cases from node v10 to v24 and this code works before
Do you know why you were calling instantiate()? It's not an API until it was added in 24.8.0 #59000 - before that it was not undocumented, but just non-existent and therefore never called; now that there's a new API that's happened to be named instantiate(), the code is invoking it which it shouldn't (because link() already does instantiation. In the new API design, you either use linkRequests() + instantiate() which allows you to do it in two different steps, or you use link() that does things in one step).
It seems there was a different instantiate() method that existed during v10-v12.11.0 until removed by #29776 , and then in v24.8.0, a new but different instantiate() was added; I think for your use case, you can either
change if (module.instantiate) to if (module.instantiate && process.version < "v13") (or other more robust way to check that it's the instantiate() method below 13)
just remove that instantiate() branch if you are not particularly interested in supporting this use case for Node.js v10-v12.11.0 in 2025.
Activity
targos commentedon Sep 12, 2025
@legendecas
alexander-akait commentedon Sep 12, 2025
Found reproducible test example:
Not sure if this is expected or not? I known
instantiateis not in official API, but we have tests cases from node v10 to v24 and this code works beforejoyeecheung commentedon Sep 14, 2025
Do you know why you were calling
instantiate()? It's not an API until it was added in 24.8.0 #59000 - before that it was not undocumented, but just non-existent and therefore never called; now that there's a new API that's happened to be namedinstantiate(), the code is invoking it which it shouldn't (becauselink()already does instantiation. In the new API design, you either uselinkRequests()+instantiate()which allows you to do it in two different steps, or you uselink()that does things in one step).joyeecheung commentedon Sep 14, 2025
It seems there was a different
instantiate()method that existed during v10-v12.11.0 until removed by #29776 , and then in v24.8.0, a new but differentinstantiate()was added; I think for your use case, you can eitherif (module.instantiate)toif (module.instantiate && process.version < "v13")(or other more robust way to check that it's theinstantiate()method below 13)instantiate()branch if you are not particularly interested in supporting this use case for Node.js v10-v12.11.0 in 2025.legendecas commentedon Sep 14, 2025
It seems like webpack is still running tests against Node.js v10.x: https://github.com/webpack/webpack/actions/runs/17681438488/job/50256443191?pr=19901. I'd agree with Joyee that this will need a version guard to continue use the already removed experimental behavior.
legendecas commentedon Sep 17, 2025
As explained in #59866 (comment), this is not a regression that needs a fix in Node.js. Feel free to re-open if you think this is not the case.