-
-
Notifications
You must be signed in to change notification settings - Fork 227
fix: v0.x dist builds to ensure SSR works properly and popper.js is included in the dist builds #146
Conversation
…ncluded in the dist builds.
rollup.config.js
Outdated
].filter(Boolean), | ||
external: ['react', 'react-dom', 'prop-types', 'popper.js'], | ||
external: ['react', 'react-dom', 'prop-types'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We specifically want to leave popper.js out the build so that people can use their own version, mock it and reduce the final bundle size.
Why do you think it should be bundled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that's how Reactstrap and various other 3rd party libraries are using react-popper
in a static sense. (The removal of popper.js after 0.8.3 broke it for us essentially locking it to that version) Essentially, think about a lot of frameworks and applications that are using React ... they want to add drop-in tooltip support and not worry about having to include an underlying tooltip api separately.
As a compromise, I wouldn't mind creating 2 versions. That's actually what we do in Reactstrap as well ... we have a full.js
version. This way people could include statically without popper.js
to use their own tooltip API implementation or use a full drop-in tooltip react-popper implementation with popper.js
.
Let me know if you're okay with that and I'll update the PR including some notes in the Readme. I'll just leave the current versions as they were and then add the corresponding full
versions that get built for each cjs
, umd
version with a full
suffix. That work?
One more thought ... I'd suggest updating the current cjs
versions to include a cjs
suffix. It's somewhat misleading as most people use umd
as the default version imported statically (reference: React's builds and readmes). Adding a cjs
suffix would help with that clarification.
Not sure how to fix the travis-ci Rake issues (they're non-related to my changes). Updated
cc @FezVrasta |
…versions, rollup cleanup, and Readme update.
ping @FezVrasta Any chance you can review so we can get this merged with a new build? |
@FezVrasta Any chance this can get merged and a new release cut? |
I don't think I understand the reasoning behind the "full version", it still requires React, React-DOM and Prop-Types. What's the point of having a version tha bundles a single dependency and no all the others? react-popper never meant to ship its own version of Popper.js, it was a misconfiguration, I'd really like to avoid to have issues open on each Popper.js release asking me to release a new "full version" with the updated Popper.js release... May you strip out all the changes unrelated to the SSR fix from this PR so we can at least merge that part? |
I can do that ... it just makes it easier to drop-in one file instead of two. I only included it that way because it was a regression without understanding that was the original intent. Upstream libraries will now need to be clear to include 2 files ( |
upstream libraries can define popper.js as dependency and include them by themselves, without having the users to worry about what dependencies are being used under the hood |
…sistency/similarity with popper.js dist structure.
Updated. I moved the UMD builds into
|
ping @FezVrasta |
Popper.js is a very bad example of dist folder structure 😅 I'd say that, or we keep everything at top level, or we keep each module type in its own folder |
You pick --- I was trying to be consistent. Additionally, keeping a module in each folder is best... That's how react does it: https://unpkg.com/[email protected]/ Otherwise, in the current version .. more people use CJS instead of probably requiring the UMD version just for lack of knowledge of module types. |
Yeah sorry, I'd like to change Popper.js but it would be a breaking change and people would get pissed off :-/ Let's try to do better here. |
…es separated by folder.
|
Thanks Fez. Ping me when you cut a release so I can update our upstream libraries. Also, can I create a new similar PR in master branch (1.0) to re-include the /dist structure similarly as I see it's missing in latest? |
Yes please, thanks! |
Fez can you release 0.10.2 in the meantime when you get a chance? Will update master branch with PR soon. Thanks |
0.10.2 published |
Fixes #145
After 0.8.3, the new dist build using Rollup config failed to include popper.js and missed some optimization settings for ensuring SSR rendering works correctly.
Updated:
popper.js
prop-types
doesn't use wrap mode which would leave an empty{}
. Instead, completely removed saving production builds a few bytes. Note that because the use of oldcontextTypes
, prop-types will still be required until new Context 16.3 is used. At that point, production builds could completely reduce the dependency for prop-types.@FezVrasta Can I create a separate PR that re-includes these rollup changes in the master branch such that /dist builds can continue to work once v1 becomes stable. Currently, the dist build was removed in the latest and will prevent 3rd party libraries that want to include popper capability via
react-popper
statically. Additionally, since it looks like work is being done to update context, the dist dependency on prop-types will go away 100%. I can also update the readme to explain the important/how to use for 3rd parties referencing statically as we do in Reactstrap./cc @TheSharpieOne Note pending successful merge + release, we need to update the readme in the next release to point to
.../0.10.2/react-popper.umd.min.js
(Note theumd
portion) and update the default codepen JS references examples to all have the latest as well.