Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp watch-examples fails #1

Closed
JedWatson opened this issue Sep 3, 2014 · 2 comments
Closed

Gulp watch-examples fails #1

JedWatson opened this issue Sep 3, 2014 · 2 comments

Comments

@JedWatson
Copy link
Owner

Not sure if this is misconfiguration or an issue with Browserify / Watchify.

When building the example files, using browserify.require files with Watchify, with the following error thrown:

Uncaught Error: Cannot find module '[...]/react-select/node_modules/react/react.js'

The issue appears to be the use of watchify.args, which is equivalent to { cache: {}, packageCache: {}, fullPaths: true }, and specifically the combination of the fullPaths: true option and require('react').

It's possible that exposing multiple packages in a bundle using browserify:require doesn't work with watchify; this would be a shame though, because it's useful to be able to develop both the react-select component (as exposed from ./lib/select.js) and the example app.js file at the same time, using Watchify.

To reproduce, npm install then

  • gulp build-examples
  • open ./examples/index.html in a browser (works)
  • gulp watch-examples
  • open ./examples/index.html in a browser (breaks)

cc @cgiffard

@JedWatson
Copy link
Owner Author

To be more specific, this is the part that seems to cause the actual error:

I'm trying to expose the react package, so subsequent calls to require('react') (in the app bundle) loads the correct module.

(I am using .exclude('react') in the app bundle)

However, it breaks when the react-select package (i.e. the code in this repo, ./lib/select.js) gets to the part where it also calls require('react').

browserify(watchify.args)
  .require('react')
  .require('./lib/select.js', { expose: 'react-select' });

If I exclude react from the common bundle too, like this:

browserify(watchify.args)
  .require('react')
  .exclude('react')
  .require('./lib/select.js', { expose: 'react-select' });

... it works for the first build, but fails on subsequent builds with a different error (react is complete omitted in subsequent builds that watchify triggers, although it works for the initial step)

@JedWatson
Copy link
Owner Author

Fixed by browserify/browserify#892

JedWatson pushed a commit that referenced this issue May 8, 2015
JedWatson pushed a commit that referenced this issue Dec 15, 2015
mehcode pushed a commit to mehcode/react-select that referenced this issue Dec 17, 2015
JedWatson pushed a commit that referenced this issue May 9, 2016
mudetroit pushed a commit to nutshellcrm/react-select that referenced this issue Jan 17, 2017
Remove loadOptions manipulation of input value
bkoltai pushed a commit to bkoltai/react-select that referenced this issue Sep 20, 2017
Allow isOpen to be controlled by the parent component
jxom added a commit to medipass/react-select that referenced this issue Oct 24, 2017
EliteMasterEric pushed a commit to EliteMasterEric/react-select that referenced this issue Dec 2, 2020
ebonow added a commit that referenced this issue Oct 17, 2021
Merging in React-Select v5.1
Rall3n pushed a commit that referenced this issue Apr 5, 2022
…lick

Allow event bubbling for dropdown click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant