React-select: Failed to compile

Created on 7 Mar 2020  路  6Comments  路  Source: JedWatson/react-select

./node_modules/react-select/src/Select.js
SyntaxError: /Users/apple/Workspace/dashboard/node_modules/react-select/src/Select.js: Unexpected token, expected "," (3:32)

  1 | // @flow
  2 | 
> 3 | import React, { Component, type ElementRef, type Node } from 'react';
    |                                 ^
  4 | import memoizeOne from 'memoize-one';
  5 | import { MenuPlacer } from './components/Menu';
  6 | import isEqual from './internal/react-fast-compare';
awaiting-author-response issubug-unconfirmed issureviewed

Most helpful comment

I got this error when I let VS Code auto-generate the import for me. I didn't realize that it went into the src directory for the import.

import Select from "react-select/src/Select";

Once I set it to the intended import Select from "react-select", it worked fine.

All 6 comments

The type key is from Flow (hence the // @flow at the top). More info can be found here: https://flow.org/blog/2015/02/18/Import-Types/.

Where are you using react-select in your project? How are you referencing it?

I'm running into the same issue. We don't use Flow, so it is not part of our build environment.

Do we need to have Flow installed & enabled to use this library? It would sad if that was true.

This worked for me
import { default as Select } from "react-select";

I got this error when I let VS Code auto-generate the import for me. I didn't realize that it went into the src directory for the import.

import Select from "react-select/src/Select";

Once I set it to the intended import Select from "react-select", it worked fine.

Hi @miladnikad and @sknutsonsf,

I wanted to check in and see if either @killerbytes or @cototal's answers have solved your problem.

Thanks @alexristich, @killerbytes and @cototal.

This issue will now be closed due to inactivity. If anyone has further feedback, the issue will be re-opened.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coder-guy22296 picture coder-guy22296  路  3Comments

pashap picture pashap  路  3Comments

ericj17 picture ericj17  路  3Comments

batusai513 picture batusai513  路  3Comments

juliensnz picture juliensnz  路  3Comments