{"id":785,"hash":"034591f5abc78e6327f9d84917d88d4be15dba18c22a701cd89ede1b2ef2ac04","pattern":"Rollup Error: &#39;isValidElementType&#39; is not exported by node_modules/react-is/index.js","full_message":"I'm building a bundle with rollUp using styled-components.\n\nMy rollup.config.js looks like:\n\nimport resolve from 'rollup-plugin-node-resolve'\nimport babel from 'rollup-plugin-babel'\nimport commonjs from 'rollup-plugin-commonjs'\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'cjs'\n  },\n  external: [\n    'react',\n    'react-proptypes'\n  ],\n  plugins: [\n    resolve({\n      extensions: [ '.js', '.json', '.jsx' ]\n    }),\n    commonjs({\n      include: 'node_modules/**'\n    }),\n    babel({\n      exclude: 'node_modules/**'\n    })\n  ]\n}\n\nAnd I'm receiving\n\n[!] Error: 'isValidElementType' is not exported by node_modules/react-is/index.js\nhttps://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module\nnode_modules/styled-components/dist/styled-components.es.js (7:9)\n5: import stream from 'stream';\n6: import PropTypes from 'prop-types';\n7: import { isValidElementType } from 'react-is';\n            ^\n8: import hoistStatics from 'hoist-non-react-statics';\n\nChecking on the node_modules itself react-is is a commonjs module as it can be checked out here as well.\n\nShouldn't  the commonjs plugin take care of it since it is inside node_modules/** ?\n\nThanks.","ecosystem":"npm","package_name":"reactjs","package_version":null,"solution":"I resolved this by using the rollup-plugin-commonjs\n\nand defining the export manually in the rollup config as below\n\nexport default {\n  input: 'src/index.js',\n  output: [\n    {\n      file: pkg.main,\n      format: 'cjs',\n      sourcemap: true\n    },\n    {\n      file: pkg.module,\n      format: 'es',\n      sourcemap: true\n    }\n  ],\n  plugins: [\n    external(),\n    postcss({\n      modules: true\n    }),\n    url(),\n    babel({\n      exclude: 'node_modules/**'\n    }),\n    resolve(),\n    commonjs({\n      include: 'node_modules/**',\n      namedExports: {\n        'node_modules/react-is/index.js': ['isValidElementType']\n      }\n    })\n  ]\n}\n\nAfter this everything worked fine.\n\nand for the info, my initial setup was done through https://github.com/transitive-bullshit/react-modern-library-boilerplate\n\nHope it works for you","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/50080893/rollup-error-isvalidelementtype-is-not-exported-by-node-modules-react-is-inde","votes":23,"created_at":"2026-04-19T04:51:42.999675+00:00","updated_at":"2026-04-19T04:51:42.999675+00:00"}