react-timezone-select icon indicating copy to clipboard operation
react-timezone-select copied to clipboard

@emotion/react when it is already loaded.

Open tal-VSL opened this issue 2 years ago • 6 comments

Hi,

How are you? We are using this great package, but we notice that when we are working locally we receive this yellow warning message in the console. We tried to update @emotion libraries but it's not solved the problem.

/node_modules/react-timezone-select/dist/esm/index.js You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.

I hope you can assist us with this manner.

tal-VSL avatar Mar 29 '22 08:03 tal-VSL

Hi, @talgki I have the same problem, so I leave a comment. I am using these libraries, can you please let me know which library are you using.

"dependencies": {
    "@fullcalendar/daygrid": "^5.10.1",
    "@fullcalendar/interaction": "^5.10.1",
    "@fullcalendar/react": "^5.10.1",
    "@mui/material": "^5.2.8",
    "@mui/styles": "^5.2.3",
    "@mui/x-data-grid": "^5.2.2",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "ra-data-json-server": "^3.19.6",
    "react": "^17.0.2",
    "react-admin": "^4.0.0-alpha.1",
    "react-dom": "^17.0.2",
    "react-multi-date-picker": "^3.3.0",
    "react-scripts": "^5.0.0",
    "react-timezone-select": "^1.3.1",
    "web-vitals": "^2.1.3"
  },

ucharles avatar Mar 29 '22 11:03 ucharles

Hi @ucharles, Here you go,

"dependencies": {
    "@date-io/moment": "^2.13.1",
    "@emotion/styled": "^11.6.0",
    "@fortawesome/fontawesome-free": "5.15.3",
    "@fullcalendar/core": "5.8.0",
    "@fullcalendar/daygrid": "5.8.0",
    "@fullcalendar/interaction": "5.8.0",
    "@mui/lab": "^5.0.0-alpha.67",
    "@mui/material": "^5.4.0",
    "axios": "^0.24.0",
    "bootstrap": "4.6.0",
    "chart.js": "^3.7.0",
    "chartjs-adapter-moment": "^1.0.0",
    "chartjs-plugin-datalabels": "^2.0.0",
    "classnames": "2.3.1",
    "dropzone": "5.9.2",
    "firebase": "^8.10.0",
    "list.js": "2.3.1",
    "moment": "2.29.1",
    "moment-timezone": "^0.5.34",
    "node-sass": "6.0.1",
    "node-sass-package-importer": "5.3.2",
    "nouislider": "15.2.0",
    "prop-types": "15.7.2",
    "quill": "1.3.7",
    "react": "17.0.2",
    "react-bootstrap-sweetalert": "5.2.0",
    "react-bootstrap-table-next": "4.0.3",
    "react-bootstrap-table2-paginator": "2.1.2",
    "react-bootstrap-table2-toolkit": "2.1.3",
    "react-chartjs-2": "^4.0.1",
    "react-copy-to-clipboard": "5.0.3",
    "react-datetime": "3.0.4",
    "react-dom": "17.0.2",
    "react-error-boundary": "^3.1.4",
    "react-jvectormap": "0.0.16",
    "react-loading-skeleton": "^3.0.2",
    "react-notification-alert": "0.0.13",
    "react-perfect-scrollbar": "1.5.8",
    "react-phone-input-2": "^2.14.0",
    "react-query": "^3.33.5",
    "react-quill": "1.3.5",
    "react-redux": "^7.2.5",
    "react-router": "5.2.0",
    "react-router-dom": "5.2.0",
    "react-scripts": "4.0.3",
    "react-select": "^5.1.0",
    "react-select2-wrapper": "1.0.4-beta6",
    "react-timezone-select": "^1.3.0",
    "react-to-print": "2.12.6",
    "reactstrap": "8.9.0",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0",
    "rsuite": "^5.6.1",
    "select2": "4.0.13",
    "styled-components": "^5.3.3",
    "sweetalert2": "11.0.18",
    "uuid": "^8.3.2"
  }

tal-VSL avatar Mar 29 '22 13:03 tal-VSL

@talgki so it looks like you're explicitly using an @emotion package as well. In @ucharles's example, I'm assuming one of your dependencies itself is using emotion.

Either way, I thought this should be taken care of by the bundler when building for prod. i.e. that it would only include one copy of the required @emotion/* packages, but maybe not. I'll take a closer look here when I have a minute :+1:

ndom91 avatar Mar 30 '22 14:03 ndom91

Hey everyone, just wanted to pop in and mention this hasn't been forgotten about. Just haven't had much time lately. Will check back into this soon!

ndom91 avatar May 01 '22 22:05 ndom91

So this is a react-select problem, but we can definitely try to find a solution here.

Digging through their previous issues, it looks like someone ran into this as well a while back (https://github.com/JedWatson/react-select/issues/4780), it looks like one person solved it, but another never returned with a working reproduction.

The person who solved their issue, fixed it by defining their @emotion/react and @emotion/react dependencies with a caret (^) in their package.json, meaning only install minor and patch version updates automatically. See https://github.com/JedWatson/react-select/issues/4780#issuecomment-921828159

Can you maybe create a reproduction in codesandbox or something like that? That would help us a lot in trying to fix it!

ndom91 avatar Jun 12 '22 17:06 ndom91

I have the same issue, I use chackra ui which uses @emoction/react and when I load timezone-select this issue happens

victorcastro89 avatar Jul 19 '22 20:07 victorcastro89

Hey folks, quick update - 1.5.1 should fix this. Thanks to @DreierF for a bundling improvement PR :pray:

ndom91 avatar Mar 27 '23 08:03 ndom91