egoist / bili

Bili makes it easier to bundle JavaScript libraries.

Home Page:https://bili.egoist.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning when using a default export

chocolateboy opened this issue · comments

Bili: v5+ | Node.js: v14.6.0 | OS: Linux (Arch)

Using a default export in an ES module results in the following warning, as of Rollup v2.2.0 (PR):

warning prefer_named_exports: Entry module "src/index.js" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "src/index.js" to use named exports only.

This isn't something that needs to be "fixed" in modules which only use default exports (i.e. which don't mix named and default exports), and developers shouldn't have to change their API to appease a bundler, so the warning should not be enabled by default.

Note: the warning is disabled by default in Rollup (it's set to auto). It's only because Bili provides a custom output config (which hasn't been updated to reflect this change) that the default setting isn't used.