Skip to content

PERFORMANCE: import statements, ../lib/... paths and tree-shaking #65

Open
@fpurcell

Description

@fpurcell

A note about using .../lib/... paths on import statements:

In a future PR, I'm going to go thru all the files in otp-ui and switch all the .../lib/... import paths to .../src/... Cole pointed out that by us using transpiled .../lib/... code, we're preventing webpack from tree-shaking the otp-ui code (at a latter date / latter production build of an app), resulting in larger footprints than might be necessary (could be a big deal, esp if all the icons from the otp-ui Icons component are repeatedly pulled into everything we do -- esp. when we might only intend to use one or a small handful of those icons). We might do more, based on Cole's continued research in making the code performant.

IMPORTANT -- this is desired:

import utils from "@opentripplanner/core-utils";
center: utils.types.latlngType.isRequired,

was:
import { latlngType } from "@opentripplanner/core-utils/src/types";
center: latlngType.isRequired,

Metadata

Metadata

Assignees

Labels

MEDIUMMedium PriorityenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions