Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIP: Migrate imports and exports from CommonJS to ES2015 #11690

Closed
wants to merge 2 commits into from

Conversation

jsnmoon
Copy link
Member

@jsnmoon jsnmoon commented Mar 1, 2017

Part of #11688.

This change will allow us to leverage Webpack 2's tree shaking optimization for ES6 modules in the future. Please share your suggestions and comments!

@matticbot matticbot added OSS Citizen [Size] L Large sized issue and removed [Size] S Small sized issue labels Mar 1, 2017
@jsnmoon jsnmoon added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Mar 2, 2017
@jsnmoon jsnmoon requested a review from ockham March 2, 2017 20:10
@ockham
Copy link
Contributor

ockham commented Mar 2, 2017

Looks sane, tho you might have to be careful with the export defaults -- those sometimes tend to break when imported CommonJS style.

But TBH, I don't know how to test VIP related stuff -- my changes to those files were part of a bulk change, and I'm not sure I even tested them myself or just asked @scottsweb to do that for me 😄

BTW @scottsweb -- is this VIP stuff inside Calypso being used at all?

var setTitle = require( 'state/document-head/actions' ).setDocumentHeadTitle,
sites = require( 'lib/sites-list' )();
import { setDocumentHeadTitle as setTitle } from 'state/document-head/actions';
const sites = require( 'lib/sites-list' )();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pattern that's used in a few places for imports like sites-list looks something like this:

import sitesFactory from 'lib/sites-list';
const sites = sitesFactory();

Though the naming isn't entirely consistent throughout the code base (here, here & here for examples)
Might it be worth making that change in this PR or leaving for another PR that targets this pattern specifically?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... let's punt that change for the next bulk change.


/**
* Internal Dependencies
*/
var setTitle = require( 'state/document-head/actions' ).setDocumentHeadTitle,
sites = require( 'lib/sites-list' )();
import { setDocumentHeadTitle as setTitle } from 'state/document-head/actions';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there's value in keeping setDocumentHeadTitle as-is vs aliasing (though I do see that either way it's out of the scope of this PR).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally on the same page, but I refrained from making too many discretionary edits :)

@matticbot
Copy link
Contributor

@jsnmoon This PR needs a rebase

@ockham
Copy link
Contributor

ockham commented Mar 8, 2017

Hmm, looks like we can close this since client/vip was actually unused and recently removed (#11818) ¯_(ツ)_/¯

@ockham ockham closed this Mar 8, 2017
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 8, 2017
@jsnmoon
Copy link
Member Author

jsnmoon commented Mar 9, 2017

Haha, works for me!

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

Successfully merging this pull request may close these issues.

None yet

4 participants