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

Module not found : React/JSX-runtime #136

Open
3 tasks done
DaanDeMot opened this issue Nov 14, 2024 · 0 comments
Open
3 tasks done

Module not found : React/JSX-runtime #136

DaanDeMot opened this issue Nov 14, 2024 · 0 comments

Comments

@DaanDeMot
Copy link

Describe the bug

Currently working with a React project 17 and after adding the React-Timezone-Select package I've got a build error saying the following :

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\Daan\Desktop\Watcherr\hcp-dashboard\node_modules\react\jsx-runtime' imported from C:\Users\Daan\Desktop\Watcherr\hcp-dashboard\node_modules\react-timezone-select\dist\index.js
Did you mean to import "react/jsx-runtime.js"?

(I've added the jsx-runtime package aswell) The same error is happening aswell whenever I refresh the page where the React-timezone-selector is being used, only after a refresh, I can use the page without breaking it if I don't refresh the page.

Searched online for a long time but nothing seems to work.

Component I made using the TimezoneSelect :

export interface SelectTimeZoneProps {
  timezone: ITimezone,
  setTimezone: (value: ITimezone) => void,
  label: string,
  required?: boolean,
}

const TimezoneSelector: React.FC<SelectTimeZoneProps> = ({
  timezone,
  setTimezone,
  label,
  required,
}) => {
  return (
    <div>
      {label && <label className={styles.InputLabel}>{label + (required ? "*" : "")}</label>}
      <TimezoneSelect value={timezone} onChange={setTimezone}/>
    </div>
  );
};
export default TimezoneSelector;

and how I use it :

 <div className="row">
        <div className="col-12 col-md-6">
          <TimezoneSelector 
            timezone={selectedTimezone} 
            setTimezone={handleTimeZoneChange} 
            label={t('site-configuration.timezone')}
            required={false}/>
           
        </div>
        <div className="col-12 col-md-6">
          <Alert type={'message'}>
            {t('site-configuration.timezone.explanation')}
          </Alert>
        </div>
      </div>

And If I click on second link of the error msg it brings me to the index of the node_module package of React-timezone-select to this line :

import { jsx } from "react/jsx-runtime";
Has anyone got an idea on how I could fix this?

Many thanks in advance.

Reproduction

install and use react-timezone-select

System Info

Windows OS

Used Package Manager

yarn

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
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

1 participant