How to import with webpack?
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Behaviour
Imports the default export
### Actual Behaviour
Webpack outputs error: `export 'default' (imported as 'balanceText') was not found in 'balance-text' (possible exports: )` and browser throws error `Uncaught TypeError: root is undefined`
### Reproduce Scenario (including but not limited to)
`npm install balance-text`
#### Steps to Reproduce
```js
import balanceText from 'balance-text'
balanceText()
```
This used to work fine. Not sure if newer Node/webpack version has caused this.
Contributor guide
Research direction
Start by reproducing the documented npm install and JavaScript import example with webpack, then inspect the package export configuration and entry point involved in resolving balance-text. Done means the default import resolves without the webpack export error and balanceText() no longer triggers the browser's root error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100