floating-ui / react-popper

🍿⚛Official React library to use Popper, the positioning library
https://popper.js.org/react-popper/
MIT License
2.5k stars 226 forks source link

Remove hypnosphi polyfill #435

Open yuri-scarbaci-lenio opened 2 years ago

yuri-scarbaci-lenio commented 2 years ago

I'm not sure how to properly build/test the project locally, I ran yarn test:jest and it worked, but running yarn build:demo would output an unexpected error about parcel and a duplicate plugin


If you'd like to use two separate instances of a plugin,
they need separate names, e.g.

  plugins: [
    ['some-plugin', {}],
    ['some-plugin', {}, 'some unique name'],
  ]

Duplicates detected are:
[
  {
    "alias": "/foobar/react-popper/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
    "dirname": "/foobar/react-popper",
    "ownPass": false,
    "file": {
      "request": "@babel/proposal-class-properties",
      "resolved": "/foobar/react-popper/node_modules/@babel/plugin-proposal-class-properties/lib/index.js"
    }
  },
  {
    "alias": "base$3",
    "options": {
      "loose": "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"
    },
    "dirname": "/foobar/react-popper",
    "ownPass": false
  }
]

nonetheless, the change should be straigth-forward, it's about removing a polyfill https://www.npmjs.com/package/@hypnosphi/create-react-context that is creating problems in modern project due to it not compiling/defining esm module in package.json, this can usually be fixed via Aliases in project, but code-sandbox has no solution to this problem, as a result when trying to use react-popper 1.3.11 in a code-sandbox we get an error image

I'm going to test this out in the project I'm working on and see if everything works as expected, if someone can provide some additional instroction on how I can make it work with flow/parcel and test it out as intended, it would be really appreciated!

N.B. I bumped the version to 1.4 because removing the polyfill could be potentially breaking for some project that are using react < 16 and depending on it...