Skip to content

Bug - react-icons 6.6.1- invalid ESM module #12657

Description

@rszwajko

Describe the problem
Webpack build fails with error:

ERROR in ./node_modules/@patternfly/react-icons/dist/esm/createIcon.js 2:0-63
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/home/xxx/repos/pf_modules/node_modules/@patternfly/react-icons/dist/esm'
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.

How do you reproduce the problem?
minimal code to recreate the issue: https://github.com/rszwajko/pf-icons-esm-bug
Initially encountered while updating libraries on older branches of https://github.com/openshift/networking-console-plugin

Expected behavior
Webpack build should work without relaxing import rules.

Is this issue blocking you?
No. Workaround exists i.e. as used here openshift/networking-console-plugin@e4ed48d

      {
        test: /\.m?js/,
        include: /node_modules\/@patternfly\/.*/,
        resolve: {
          fullySpecified: false,
        },
      },

What is your environment?
React 17
react-icons 6.6.1

What is your product and what release date are you targeting?
https://github.com/openshift/networking-console-plugin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions