This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 126
Exports whose names aren't explicit in the file being transformed #18
Comments
Actually, this might be a better solution (as it might also be a good workaround for #9): Add a new config option for this plugin, allowing me to manually specify, per file, any extra names that the file should export. {
npm({jsnext: true, main: true}),
commonjs({
include: ['node_modules/**'],
addExports: {
'node_modules/bluebird/js/release/bluebird.js': ['promisify', 'coroutine']
}
})
} The Would that work? |
Sorry for delay. This is a brilliant idea! And obvious when you mention it. Have implemented it in #18, with just a minor tweak ( |
Released in 2.1.0 |
namedExports is sometimes ignored or doesn't work. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Input:
Using the npm and commonjs plugins, I get the error:
Here's the contents of that
bluebird.js
file:...and here it is after commonjs transformed it:
I guess the problem is the file doesn't actually mention the name
promisify
so there's no way for this plugin to know that the module actually does (in commonjs terms) export the namepromisify
.A workaround is to change the importing file like this:
But it would be nicer if there was some way rollup could handle this scenario. For example, could rollup try to recover from the "Module X does not export [name]" error like this: check if the module has a default export, and if so, include that whole default in the bundle and then add some code that just grabs the relevant property off it (
var promisify = _ref.promsify;
)? Behind a config option maybe?The text was updated successfully, but these errors were encountered: