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
{{ message }}
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.
I have a vanilla JS web component that defines named exports in src/index.js like such:
export { a, b, c }
This leads to the umd global variable being undefined.
If changing above to a default export
export default { a, b, c }
things work for umd, and the umd variable is an object as expected { a, b, c }
I've read that nwb recently dropped the need to address default exports via .default.
Perhaps that change has to be skipped if named exports are present?
Is the version of nwb you're using installed globally or locally?
global
Which versions of Node.js, npm and nwb are you using (if using it globally)?
node v8.9.1, yarn@1.3.2, nwb@0.20.0
The text was updated successfully, but these errors were encountered:
I've created a Webpack feature request for this, as it would be nice for everyone if output.libraryExport automatically exported the default export when a library's entry module is using ES2015 modules instead of having to configure it:
Add support for some new configuration under the umd config object in nwb.config.js to tell nwb how you're exporting your library (low effort)
e.g. umd.exports, which can be default or named and is used to set Webpack's output.libraryExport appropriately
e.g. umd.entry, which allows you to provide a separate entry module for UMD builds which must export default
Add comments to src/index.js in the react-component and web-module project templates to document that you must export default or the UMD build won't work by default, with directions to the appropriate configuration options if you'd rather use named exports because default.
Switch nwb over to Rollup for UMD builds (high effort, need to investigate Rollup properly and its plugin ecosystem for parity with features available in current Webpack build, such as aliases and defining replacements of certain expressions)
It's not ideal, but in the meantime you should be able to use webpack.extra or webpack.config() in nwb.config.js to override output.libraryExport when performing a UMD build.
This issue is a:
I have a vanilla JS web component that defines named exports in
src/index.js
like such:This leads to the umd global variable being undefined.
If changing above to a default export
things work for umd, and the umd variable is an object as expected
{ a, b, c }
I've read that nwb recently dropped the need to address default exports via
.default
.Perhaps that change has to be skipped if named exports are present?
Is the version of
nwb
you're using installed globally or locally?global
Which versions of Node.js, npm and nwb are you using (if using it globally)?
node v8.9.1, yarn@1.3.2, nwb@0.20.0
The text was updated successfully, but these errors were encountered: