Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Tree shaking and partial imports. #19

Closed
DylanPiercey opened this issue Oct 30, 2016 · 8 comments
Closed

Tree shaking and partial imports. #19

DylanPiercey opened this issue Oct 30, 2016 · 8 comments

Comments

@DylanPiercey
Copy link

DylanPiercey commented Oct 30, 2016

Is this something that can be done here?

I figured something like

import('lodash', 'map').then(map => ...)

Just curious if this has been thought of.

@Mouvedia
Copy link

You meant import(… instead of Import(… right?

@DylanPiercey
Copy link
Author

@Mouvedia was on a phone, but I fixed that.

@domenic
Copy link
Member

domenic commented Oct 30, 2016

I don't really understand this issue. What bug are your reporting with the current proposal? Are you trying to create another proposal? If so this isn't the place for it.

@DylanPiercey
Copy link
Author

@domenic I am merely asking if there is something synonymous with

import { map } from 'lodash'

In this proposal.

@domenic
Copy link
Member

domenic commented Oct 30, 2016

You can do import('lodash').then(ld => ld.map).

@domenic domenic closed this as completed Oct 30, 2016
@DylanPiercey
Copy link
Author

@domenic I am aware of that. Was just curious since obviously that doesn't support tree shaking.

@domenic
Copy link
Member

domenic commented Oct 30, 2016

From what I understand, tree-shaking is a nonstandard way of using modules supported by some ahead-of-time tooling that turns those modules into non-modules. It's not really something that informs the design of the language, but instead is something for those creating such tools to work through on their own.

@caridy
Copy link

caridy commented Nov 16, 2016

@DylanPiercey to be precise here, if you have a tool that can do tree shaking on something like:

import * as foo from "foo";
foo.x('do something');

Assuming that foo exports a lot more than just x, then it is very likely that the same tool can work the same way with import("foo").

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants