Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.

package.json: Change main to esnext#226

Open
ockham wants to merge 2 commits intomasterfrom
update/package-json-main-to-module-take-two
Open

package.json: Change main to esnext#226
ockham wants to merge 2 commits intomasterfrom
update/package-json-main-to-module-take-two

Conversation

@ockham
Copy link
Contributor

@ockham ockham commented Feb 5, 2018

Reboot of #174. Don't merge yet!

Copying/updating #174's PR desc:


To better denote we're dealing with untranspiled code.

Companion Calypso PR: Automattic/wp-calypso#19698

To provide a bit of an explanation -- esnext is a custom field.

  • We'll specify it as a possible entry point for webpack to watch out for here.
  • OTOH, we use it (as opposed to main) as a flag to indicate that this is a package's entrypoint for untranspiled code here.

This is a strategy found at http://2ality.com/2017/06/pkg-esnext.html.

Suggested order:

@ockham ockham self-assigned this Feb 5, 2018
@dmsnell
Copy link
Member

dmsnell commented Feb 5, 2018

Does this need a version bump? Could we instead just add the esnext property and keep main?

@ockham
Copy link
Contributor Author

ockham commented Feb 23, 2018

I think by convention, main implies ES5 code, whereas it's esnext (or module) that means untranspiled code.

@kwight
Copy link
Contributor

kwight commented Mar 6, 2018

@ockham Anything we need here to move this forward?

@ockham
Copy link
Contributor Author

ockham commented Mar 7, 2018

@kwight Automattic/wp-calypso#19698 needs more testing -- @dmsnell discovered that right now it actually bloat bundle sizes rather than shrinking them.

I'm seeing more and more npms published with untranspiled code included, so IMO it'd be a really nice feature to be able to import that code OOTB...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants