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
This is because the CJS wrapper in @proload/core does not re-export the same object (the load function) in ESM module.
// @proload/core/lib/cjs/index.cjsfunctionload(...args){returnimport('../esm/index.mjs').then(({default: loader})=>loader(...args));// ^ the real load function in ESM}
The real one (in ESM module) does have the load.use() method, while the CJS one does not implement corresponding wrapper.
You can compile your script to ESM format with format: 'esm', which should work. (Don't forget to change the extension to .mjs for node.js to run correctly).
As for the package author, they can implement such wrapper instead,
// @proload/core/lib/cjs/index.cjslet_use_pluginsasyncfunctionload(...args){constmod=awaitimport('../esm/index.mjs')if(_use_plugins){mod.default.use(_use_plugins)_use_plugins=undefined}return(0,mod.default)(...args)}load.use=functionuse(plugins){(_use_plugins||=[]).push(...plugins)load.plugins.push(...plugins)// XXX not the same array in ESM!}// caveat: cannot wrap `load.plugins` correctly because it is syncload.plugins=[]
The text was updated successfully, but these errors were encountered:
When setting proload to external in esbuild, it fails to load.
Reproduction :
git clone https://github.com/Alexandre-Fernandez/esbuild-proload &&
cd esbuild-proload &&
npm i &&
npm run debug
Reason (evanw/esbuild#2650 (comment)) :
The text was updated successfully, but these errors were encountered: