downshift icon indicating copy to clipboard operation
downshift copied to clipboard

Error: isForwardRef not exported.

Open andreoav opened this issue 8 years ago • 9 comments

  • downshift version: >= 3.1.3
  • node version: 10
  • npm (or yarn) version: latest

Relevant code or config

commonjs({
  include: 'node_modules/**',
  namedExports: {
    'react-is': ['isForwardRef', 'isValidElementType'],
  },
}),

What you did: Upgrade downshift from version 3.1.2

What happened:

[!] Error: 'isForwardRef' is not exported by node_modules/downshift/node_modules/react-is/index.js
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
node_modules/downshift/dist/downshift.esm.js (8:9)
 6: import React, { Component } from 'react';
 7: import PropTypes from 'prop-types';
 8: import { isForwardRef } from 'react-is';
             ^
 9:
10: // istanbul ignore next
Error: 'isForwardRef' is not exported by node_modules/downshift/node_modules/react-is/index.js

Problem description:

After upgrading from downshit 3.1.2 my rollup build throws the error above. I had a configuration for react-is used by my package itself and other dependencies. I also have react-is as a dependency.

andreoav avatar Nov 20 '18 11:11 andreoav

I have no idea why that's happening. Based on https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module it looks like you're configuring things correctly... :-/

kentcdodds avatar Nov 20 '18 20:11 kentcdodds

I'll try to investigate and double check if did everything correctly.

andreoav avatar Nov 20 '18 22:11 andreoav

I did a fresh install of everything a 3rd time and everything work. Closing this issue since I was not able to reproduce it again.

andreoav avatar Nov 21 '18 13:11 andreoav

If anyone else comes to this issue and needs a bit more help on this, you may need to update the key used in the namedExports config object in your Rollup config.

commonjs({
  include: 'node_modules/**',
  namedExports: {
    'react-is': ['isForwardRef', 'isValidElementType'],
  },
}),

or 

commonjs({
  include: 'node_modules/**',
  namedExports: {
    'node_modules/react-is/index.js': ['isForwardRef', 'isValidElementType'],
  },
}),

As always, your mileage may vary.

jeffboyus avatar Feb 04 '19 18:02 jeffboyus

The above solution doesn't work for me

alex-shamshurin avatar Oct 26 '19 12:10 alex-shamshurin

the above solution doesn't work for me neither

selena-mallet avatar Apr 14 '20 07:04 selena-mallet

The above doesn't work for me

azz0r avatar Feb 04 '21 13:02 azz0r

In our code we have the first version and it works.

config.plugins[cjsPluginIndex] = commonjs({
  include: 'node_modules/**',
  namedExports: {
    'react-is': ['isForwardRef'],
  },
})

silviuaavram avatar Feb 04 '21 13:02 silviuaavram

Thanks, that update switches it to a prop-types issue. I am in mono repo and there is a peer dep for the prop-types here.

[!] Error: 'default' is not exported by ../../node_modules/prop-types/index.js, imported by ../../node_modules/@material-ui/utils/esm/elementAcceptingRef.js

azz0r avatar Feb 04 '21 13:02 azz0r