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
in the browser window.awesomeFunction is the object {__esModule: true}, where as window.awesomeFunction.default is the actual function.
I understand why this is the case, but the solution from when the issue was mention earlier was to change the exported function type to module.exports. But wouldn't it be nicer/more convienient if there was an option in the builder to assign the default export directly to the globalName?
// bundle.jsawaitesbuild.build({entryPoints: ['foo.js'],minify: true,format: "iife",globalName: "awesomeFunction",assignDefault: true,// default can be false if ommited, so it'll be backward compatibleoutfile: 'foo.min.js'})
...Or, is there a way to do this already, without having to change the import
Extending on this... Maybe an option for using the name of the function (if it has been named) from the import as the globalName
// bundle.jsawaitesbuild.build({entryPoints: ['foo.js'],minify: true,format: "iife",globalName: true,// not sure how one could pass implicity naming??? // Probably would require a fallback incase there wasn't a default (or if it wasn't named) outfile: 'foo.min.js'})
The text was updated successfully, but these errors were encountered:
To achieve something similar to what you're asking for, I'm using esbuild to generate the ESM bundle, then feeding it to rollup to produce other formats like CJS and IIFE (which will reduce some code of preserving ESM bindings semantics).
in the browser
window.awesomeFunction
is the object{__esModule: true}
, where aswindow.awesomeFunction.default
is the actual function.I understand why this is the case, but the solution from when the issue was mention earlier was to change the exported function type to
module.exports
. But wouldn't it be nicer/more convienient if there was an option in the builder to assign the default export directly to the globalName?...Or, is there a way to do this already, without having to change the import
Extending on this... Maybe an option for using the name of the function (if it has been named) from the import as the
globalName
The text was updated successfully, but these errors were encountered: