frintjs/frint

Support easier individual imports of modules

Open

#336 创建于 2017年10月12日

在 GitHub 查看
 (1 评论) (1 反应) (0 负责人)JavaScript (746 star) (37 fork)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.

贡献者指南