Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

'default' is not exported error #186

Closed
mwilc0x opened this issue Mar 21, 2017 · 4 comments
Closed

'default' is not exported error #186

mwilc0x opened this issue Mar 21, 2017 · 4 comments

Comments

@mwilc0x
Copy link

mwilc0x commented Mar 21, 2017

Hi,

I'm running into an issue with rollup-plugin-commonjs 8.0.2, trying to pull in redux.

It looks like this is related to #44, which looks like it was merged, but I'm still getting an issue...

Here is what my rollup.config looks like:

'use strict';

const babel = require("rollup-plugin-babel");
const commonjs = require("rollup-plugin-commonjs");
const uglify = require("rollup-plugin-uglify");
const nodeResolve = require('rollup-plugin-node-resolve');
const replace = require('rollup-plugin-replace');

module.exports = {
    format: 'umd',
    moduleId: 'Inferno',
    moduleName: 'Inferno',
    entry: "./index.js",
    dest: 'public/bundle.js',
    plugins: [
    	replace({
    	    'process.env.NODE_ENV': JSON.stringify( 'production' )
    	}),
        babel({
            presets: ['es2015-rollup'],
            plugins: ['inferno'],
            exclude: "node_modules/**"
        }),
        commonjs({
            include: 'node_modules/**',
            namedExports: {
                'node_modules/inferno-redux/index.js': [ 'Provider' ],
            }
        }),
    	nodeResolve({
    	    module: true,
        }),
        uglify()
    ]
};

The entry index.js is a single file and it's pulling in these three imports:

import Inferno from 'inferno';
import { Provider } from 'inferno-redux';
import { createStore } from 'redux';

When it builds it displays:

'default' is not exported by 'node_modules/redux/es/index.js'

At first it was complaining about the Provider export from inferno-redux but I could get it to see that using the namedExport. However, I'm not having such luck with the createStore import for redux.

Am I missing something in the config?

Thanks.

@mwilc0x
Copy link
Author

mwilc0x commented Mar 23, 2017

Ok, so a follow-up on this...

If I remove inferno-redux and just try to pull in redux it works fine, i can log out the function successfully.

The problem comes up when I pull in namedExports: { 'node_modules/inferno-redux/index.js': [ 'Provider' ], } to commonjs and then I run into the 'default' is not exported by 'node_modules/redux/es/index.js'

Note: I'm not sure which library might be causing this, or if this is even an issue with rollup

@mwilc0x
Copy link
Author

mwilc0x commented Mar 23, 2017

Also, I created a simple repo which reproduces the issue:

https://github.com/mjw56/inferno-redux-rollup

@mwilc0x
Copy link
Author

mwilc0x commented Mar 23, 2017

Also, I can get around it if I add skip: [ ‘redux’ ] to nodeResolve but it throws a bunch of warnings about resolving redux

@mwilc0x
Copy link
Author

mwilc0x commented Mar 23, 2017

Closing this, realized it was warning but the code is actually building fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant