whitphx / react-ymd-date-select

Hooks and components for Y-M-D dropdowns with React
https://whitphx.github.io/react-ymd-date-select/
MIT License
45 stars 6 forks source link

ReferenceError: exports is not defined in ES module scope #85

Closed sebastien-comeau closed 1 year ago

sebastien-comeau commented 1 year ago

I have the following error when running the application with the library.

ReferenceError: exports is not defined in ES module scope This file is being treated as an ES module because it has a '.js' file extension and 'C:\my-app\node_modules\react-ymd-date-select\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

I'm using Next.JS 12 with TypeScript. Here's my tsconfig.json file content:

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "incremental": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}

If I remove "type": "module", from the library package.json it works.

whitphx commented 1 year ago

Thank you for the report! This will be fixed with v0.3.0