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

Dynamically load jQuery on the desktop #27908

Merged
merged 1 commit into from
Oct 18, 2018
Merged

Conversation

blowery
Copy link
Contributor

@blowery blowery commented Oct 17, 2018

PR #27778 ended up pulling jQuery into the vendor~build bundle due to a conditional require in lib/load-script. Get it back out of build by dynamically loading jQuery on desktop. Webpack will still see this require on the normal web build as a require.ensure and build a chunk for it, which we'll probably never load.

@matticbot
Copy link
Contributor

@blowery blowery requested review from vindl and a team October 17, 2018 18:08
@blowery blowery added Framework [Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. labels Oct 17, 2018
@blowery blowery requested a review from adlk October 17, 2018 18:09
@blowery blowery self-assigned this Oct 17, 2018
@ghost
Copy link

ghost commented Oct 17, 2018

Warnings
⚠️

The PR is missing at least one [Status] label. Suggestions: [Status] In Progress, [Status] Needs Review

⚠️

"Testing instructions" are missing for this PR. Please add some.

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Calypso maintainers do their job. If you think 'Testing instructions' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS

@blowery blowery force-pushed the try/asyncload-jquery-on-desktop branch from bff737d to 5eb8531 Compare October 17, 2018 18:22
Copy link
Member

@vindl vindl left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

@@ -32,7 +30,7 @@ const config = {
[ '@babel/plugin-proposal-class-properties', { loose: true } ],
[ '@babel/plugin-transform-classes', { loose: false } ],
[ '@babel/plugin-transform-template-literals', { loose: true } ],
isCalypso && [
[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this might have some adverse impact on the sdk? tests seem ok... looks like no one had written a test for code that uses asyncRequire before. @dmsnell @ockham any thoughts on this?

@blowery
Copy link
Contributor Author

blowery commented Oct 17, 2018

Thanks @vindl! @jsnajdr @dmsnell @ockham @sirreal I changed the babel config as part of this to always include the asyncRequire / AsyncLoad transform. It was previously not being run on test code, which prevented us from testing code that uses asyncRequire.

Does anyone know why we were restricting that transform before?

@blowery blowery added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs e2e Testing labels Oct 17, 2018
@dmsnell
Copy link
Member

dmsnell commented Oct 17, 2018

Does anyone know why we were restricting that transform before?

Not me but it seems like a reasonable assumption that it would be web-only since that's where the async constraint comes in.

I'm fine removing it - thanks for this update!

@sirreal
Copy link
Member

sirreal commented Oct 18, 2018

Does anyone know why we were restricting that transform before?

I'd speculate, like @dmsnell, that this was because the Desktop app supposes it has access to the entire app immediately and doesn't need to request bundles over the network as the app loads. code-splitting is disabled for Desktop:

"code-splitting": false,

With that in mind, it doesn't seem like the AsyncRequire transform should be harmful in any way, I'd expect webpack to just treat the require.ensure( module ) that are generated the same as require( module ).

@sirreal sirreal added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Oct 18, 2018
@blowery blowery merged commit 3975b6d into master Oct 18, 2018
@blowery blowery deleted the try/asyncload-jquery-on-desktop branch October 18, 2018 17:04
@blowery blowery removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Needs e2e Testing labels Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. Framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants