frintjs / frintjs/frint

Support easier individual imports of modules

Open
#336 1 comment 1 reaction 0 assignees View on GitHub
good first issue help wanted optimization
Dominant language
JavaScript
Stars
756
Forks
33
PR merge metrics
No merged PRs in 30d

Description

## Currently

Everywhere, including documentation and examples, we ask developers to import modules from the package directly, like this:

```js
import { Region } from 'frint-react';

// this import also brings `render` and `streamProps` for example
```

Some applications may need only one specific module from a given package, but they will still end up loading all the modules from that package in the runtime.

We can possibly get around this by tree-shaking during the bundling process, but the application on the server will not benefit from it in any way.

## Area for improvement

Without breaking the API, allow developers to import only the modules they want individually, like this:

```js
import Region from 'frint-react/Region';
```

To do this, we need to add files in the root directory of the packages according to the exported module names listed in their main `index.js` file.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting each package's main index.js file and the exported module names it lists, then compare the package root structure. Done means individual imports such as frint-react/Region work without breaking the existing package-level API or requiring unrelated modules at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.