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

TypeError: Object(...) is not a function #2

Closed
tatchi opened this issue Sep 19, 2018 · 2 comments
Closed

TypeError: Object(...) is not a function #2

tatchi opened this issue Sep 19, 2018 · 2 comments
Assignees

Comments

@tatchi
Copy link

tatchi commented Sep 19, 2018

TypeError: Object(...) is not a function

With the new version 0.11 which fix issue #1, I have now an error when trying to import the getBundles function.

import { getBundles } from 'react-loadable-ssr-addon'

Expected Behavior

No Errors

Current Behavior

I got the following error:

TypeError: Object(...) is not a function

Possible Solution

I was able to make it work if in the index.js file, we export the two modules like that:

module.exports = { ReactLoadableSSRAddon, getBundles };

and we import them like:

const { ReactLoadableSSRAddon } = require('react-loadable-ssr-addon');
import { getBundles } from 'react-loadable-ssr-addon'

I was not able to find a way to keep the default export. I don't have any experience with bundling lib, but I suppose it's a problem with the different modules systems.

@themgoncalves
Copy link
Owner

Thanks for reporting @tatchi .
This issue was not noticed before because in ours tests we were importing the getBundles straight from its path, e.g. import getBundles from 'react-loadable-ssr-addon/lib/getBundles'.

We will fix that and release a patch today.

@themgoncalves
Copy link
Owner

Fixes for this bug was release in the v0.1.2.
The initial compatibility was maintained, so you can return using the default import.

const ReactLoadableSSRAddon = require('react-loadable-ssr-addon');
// or
const ReactLoadableSSRAddon = require('react-loadable-ssr-addon/lib/ReactLoadableSSRAddon');


import { getBundles } from 'react-loadable-ssr-addon';
// or
import getBundles from 'react-loadable-ssr-addon/lib/getBundles';

Also in the Release history we mentioned you due to your report.

@themgoncalves themgoncalves self-assigned this Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants