casesandberg / casesandberg/react-color

Uncaught TypeError: Cannot read property 'isValidHex' of undefined

Open
#807 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

When using with webpack since 2.19.3 it breaks when:

```
import color from 'react-color/lib/helpers/color'

... then in code use:
color.isValidHex(data.hex)
```
causes error.

I guess it is because in color.js there are:
```
exports.isvalidColorString = exports.red = exports.getContrastingColor = exports.isValidHex = exports.toState = exports.simpleCheckForValidColor = undefined;
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the webpack failure with the import shown in the issue and inspect color.js, especially its exported isValidHex value. Compare the built module's exports with the source module and verify that color.isValidHex(data.hex) is callable without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.