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

fix(build): inform rollup of react-popper exports #887

Closed
wants to merge 1 commit into from

Conversation

TheSharpieOne
Copy link
Member

This brings react-popper back to ^0.8.2, but adds some rollup config to allow the build to deal with how react-popper is defining the exports.

CC @supergibbs

@TheSharpieOne TheSharpieOne requested a review from supergibbs March 6, 2018 16:07
@virgofx
Copy link
Collaborator

virgofx commented Mar 6, 2018

@TheSharpieOne can you zip up the output bundles and attach those and I'll test the external mechanism as outlined in that other issue to make sure this works.

Copy link
Collaborator

@supergibbs supergibbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice workaround!

@TheSharpieOne
Copy link
Member Author

@virgofx
Copy link
Collaborator

virgofx commented Mar 6, 2018

👍 will test later tonight (hopefully if time permits)

@virgofx
Copy link
Collaborator

virgofx commented Mar 8, 2018

Tested with the version you linked. There's still a build error when running Server Side rendering.

Line 8:

TypeError: Cannot use 'in' operator to search for 'default' in undefined

var ReactDOM__default = 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM;

It looks like this is a result of the ReactPortal as outlined in that other issue. The importing of the react-portal seems to maybe mess up a few things:

OLD WORKING CODE:

var ReactDOM__default = ReactDOM && 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM;

NEW LINE:

var ReactDOM__default = 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM;

Since ReactDOM is undefined on the server side you'd expect this to be undefined without erroring. Not sure how to get this back?

The rendering of portals done in react-portal and react-popper both use proper utility classes to ensure rendered content does NOT happen on the server side, so I'm not sure where this is happening from.

Side note: It looks like prop-types is now getting included from the react-portal package as well. Size is up from 164KB uncompressed to 178KB - beta.2/ or 180KB with this version. It shouldn't be hard to include the remove prop-types babel plugin as it's pretty safe.

@TheSharpieOne
Copy link
Member Author

@virgofx so what is the fix for TypeError: Cannot use 'in' operator to search for 'default' in undefined? Do we just add another edit to the postbuild script to change
var ReactDOM__default = 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM; to var ReactDOM__default = ReactDOM && 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM;

@virgofx
Copy link
Collaborator

virgofx commented Mar 16, 2018

Let me look at it tomorrow. We could do that ... I'd like to know why it changed. Not sure if it's a rollup change , or because of the way we're using one of our dependencies.

@TheSharpieOne
Copy link
Member Author

This is not longer needed.

@TheSharpieOne TheSharpieOne deleted the fix/build-react-popper-export branch April 18, 2018 14:53
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

Successfully merging this pull request may close these issues.

3 participants