adobe / adobe/balance-text

How to import with webpack?

Open
#142 3 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.