svg-to-geojson icon indicating copy to clipboard operation
svg-to-geojson copied to clipboard

Support easier individual imports of modules

Open fahad19 opened this issue 7 years ago • 1 comments

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.

fahad19 avatar Oct 12 '17 08:10 fahad19

better do named exports:

import { Region } from 'frint-react/Region';

instead of:

import Region from 'frint-react/Region';

fahad19 avatar Nov 09 '17 14:11 fahad19