GoncharukBro / react-input

98 stars 7 forks source link

Need to use 'fullySpecified' Webpack 5 config #30

Open jschen2 opened 2 months ago

jschen2 commented 2 months ago

I imported this to use in my project that was built using create-react-app and I'm met with the following error when attempting to run it.

Module not found: Error: Can't resolve 'react/jsx-runtime' in '/node_modules/@react-input/mask/mask/dist/module' Did you mean 'jsx-runtime.js'? BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

I'm on react-scripts@5.0.1, webpack@5.91.0, and react@17.0.2. A solution I found was to modify the webpack config by adding

     {
        module: {
          rules: [
            {
              test: /\.m?js/,
              resolve: {
                fullySpecified: false
              }
            },
          ],
        },
      }

Is there something that can be done that doesn't force me to add this to the config?

GoncharukBro commented 6 days ago

Please install the "1.2.6" version of the package that includes this fix:

npm i @react-input/mask@1.2.6