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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彈 Lazy building 3p integrations #32772

Merged
merged 3 commits into from
Mar 24, 2021

Conversation

powerivq
Copy link
Contributor

@powerivq powerivq commented Feb 19, 2021

Currently, 3p integrations cannot be lazily built. This PR fixes the lazy building so that gulp can defer building 3p integration JS files till needed.

@powerivq powerivq requested a review from rsimha February 19, 2021 23:57
@amp-owners-bot
Copy link

Hey @rsimha! These files were changed:

build-system/server/lazy-build.js

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

One preliminary comment below to make this code more efficient. Happy to take another look.

build-system/tasks/3p-vendor-helpers.js Outdated Show resolved Hide resolved
@powerivq powerivq requested a review from rsimha March 4, 2021 17:52
@powerivq powerivq force-pushed the fix-lazy-build-3p branch 2 times, most recently from 08acda6 to 7337a2a Compare March 23, 2021 10:12
@powerivq
Copy link
Contributor Author

@rsimha updated to fix conflicts. mind take another look?

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Almost there. A couple comments below.

@@ -15,18 +15,24 @@
*/
'use strict';

const {generateBundles} = require('../tasks/3p-vendor-helpers');
Copy link
Contributor

Choose a reason for hiding this comment

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

Consolidate this with the other require statement from the same file.

const argv = require('minimist')(process.argv.slice(2));
const {
doBuildExtension,
maybeInitializeExtensions,
getExtensionsToBuild,
} = require('../tasks/extension-helpers');
const {buildVendorLazily} = require('../tasks/3p-vendor-helpers');
Copy link
Contributor

Choose a reason for hiding this comment

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

Consistency nit: The "lazy" part comes from how the function is called and not what it does. Can we name this doBuild3pVendor to be consistent with doBuildJs?

Comment on lines +145 to +147
? new RegExp(`\\/dist\\.3p\\/${VERSION}\\/vendor\\/([^\/]*)\\.js`) // '/dist.3p/21900000/vendor/*.js'
: /\/dist\.3p\/current\/vendor\/([^\/]*)\.max\.js/; // '/dist.3p/current/vendor/*.max.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

}

/**
* Generate bundles for all JS to be built.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should this be Generate bundles for all 3p vendors to be built?

@powerivq
Copy link
Contributor Author

@rsimha thanks! updated.

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

LGTM!

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

3 participants