frintjs/frint

Support easier individual imports of modules

Open

#336 opened on 2017年10月12日

GitHub で見る
 (1 comment) (1 reaction) (0 assignees)JavaScript (746 stars) (37 forks)batch import
good first issuehelp wantedoptimization

説明

Currently

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

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:

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.

コントリビューターガイド