Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup Complaining About External Dependencies #524

sunjay opened this issue Feb 21, 2016 · 3 comments


None yet
4 participants
Copy link

commented Feb 21, 2016

Here's a gist of a minimal example of this issue:

I was trying to setup rollup with React, Redux and React-Redux today when I came across this bug. I'm not sure if this is a bug in rollup.js or one of its plugins so I'm just filing it here.

The problem is that react-redux uses require('redux') directly (since it's not an ES6 library). redux doesn't export any default so I get the following error:

Module /tmp/rollup-bug/node_modules/redux/es/index.js does not export default (imported by /tmp/rollup-bug/node_modules/react-redux/lib/utils/wrapActionCreators.js)
Error: Module /tmp/rollup-bug/node_modules/redux/es/index.js does not export default (imported by /tmp/rollup-bug/node_modules/react-redux/lib/utils/wrapActionCreators.js)
    at Module.trace (/usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Module.js:620:30)
    at /usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Module.js:200:35
    at Array.forEach (native)
    at /usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Module.js:197:25
    at Array.forEach (native)
    at Module.bindAliases (/usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Module.js:186:29)
    at /usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Bundle.js:81:44
    at Array.forEach (native)
    at /usr/lib/node_modules/rollup/www/ROLLUP/rollup/src/Bundle.js:81:18
    at tryCatch (/usr/lib/node_modules/rollup/www/ROLLUP/rollup/node_modules/es6-promise/lib/es6-promise/-internal.js:182:12)
Type rollup --help for help, or visit

This happens when I run rollup -c. Since this is an external dependency and since it isn't using es6 in the first place, there's not a lot I can do about this bug.

I was able to isolate it down to the bare minimum so I know that it isn't anything in my code specifically.

Here's my rollup.config.js:

import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';

export default {
  // The entry and destination need to be specified
  entry: 'index.jsx',
  dest: 'index.js',
  format: 'iife',
  intro: '/* Author: Sunjay Varma <> */',
  sourceMap: 'inline',
  plugins: [
      babelrc: false,
      exclude: 'node_modules/**',
      presets: ["react", "es2015-rollup"]
      jsnext: true,
      main: true,
      browser: true,
      extensions: ['.js', '.jsx']
      include: 'node_modules/**'

The index.jsx file:

import {Provider} from 'react-redux';

The package.json file:

  "name": "rollup-bug",
  "version": "1.0.0",
  "description": "",
  "main": "rollup.config.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "MIT",
  "dependencies": {
    "react": "^0.14.7",
    "react-redux": "^4.4.0",
    "redux": "^3.3.1"
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-preset-es2015": "^6.5.0",
    "babel-preset-es2015-rollup": "^1.1.1",
    "babel-preset-react": "^6.5.0",
    "rollup": "^0.25.4",
    "rollup-plugin-babel": "^2.3.9",
    "rollup-plugin-commonjs": "^2.2.1",
    "rollup-plugin-node-resolve": "^1.4.0"

I had a feeling that this might be something to do with the commonjs or node resolve plugins, but I didn't see any option in their documentation that would address this.

Maybe there's something that I missed?



This comment has been minimized.

Copy link

commented Feb 22, 2016

It's a rollup-plugin-commonjs issue, but you couldn't figure that out without looking through the sources! :-)

Problem was that, you can guess, rollup-plugin-commonjs automatically imports the default export, but things die when it doesn't have it, even though it is not used anywhere. I opened a PR on the commonjs plugin to fix it, if the author is okay with actually allowing this behaviour :-) rollup/rollup-plugin-commonjs#44


This comment has been minimized.

Copy link

commented Feb 23, 2016

@dralletje Thanks! Let's hope they respond to your PR soon.

@TrySound TrySound closed this Jul 18, 2016

pseudoramble added a commit to pseudoramble/nim that referenced this issue Jul 26, 2016

Updated rollup-plugin-commonjs to accomodate a bug related to using r…
…eact-redux. See here: rollup/rollup#524.

Connected the app together using Redux to begin implementing basic game interaction.
Implemented basic gameplay and interaction with the computer.

This comment has been minimized.

Copy link

commented Oct 2, 2016

I'm having a similar error when using ionic2 rc0. I'm new to rollup and trying to shift my project from gulp to rollup. I've the 5.0.4 commonjs plugin

Any idea on how I can solve this?

Rollup and Redux: “index.js does not export default”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.