-
Notifications
You must be signed in to change notification settings - Fork 126
module.exports = { foo: 'bar' } fails to create named exports and results in "does not export foo" error . #115
Comments
With version 5.0.4, I'm seeing the same issue with rx.disposables. It doesn't occur anymore after downgrading to 4.1.0. |
Same issue with
I also do confirm that downgrading to 4.1.0 solved problem. Seems that optimization introduced in #106 caused this problem. |
Apologies for the delay. More recent versions of Rollup will give you a more helpful error message pointing to this page: https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module Essentially, you need to use the |
NamedExports doesn't work in all cases. |
Consider the following commonjs module:
If I attempt to do...
...rollup will produce the following error:
Looks like the module gets transpiled into:
However, if I do
module.exports.foo = 'bar'
, this error does not occur. The transpiled code is:Many commonjs exports utilize the
module.exports = { ... }
pattern, and each property in the module.exports object should be properly transpiled to a named export.This specifically affects the React npm module which exports all of its named exports as properties on an object that gets later assigned to
modules.exports
:This makes the following common code fail:
The text was updated successfully, but these errors were encountered: