-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update WordPress dependencies #35729
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~3365 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~1730 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
Yasss! Let's do this. Only that now Eslint warns about |
In the FSE sources? Or somewhere else? Hopefully we can teach the rule about the externalized deps 🙂 |
Does this affect folks working with TypeScript? cc @Automattic/type-review |
That's an interesting question. We don't bundle the code, but need the types. The types are not in the |
There might've been talks about bringing Types to
...and if so, would it help to add them to |
I pulled this branch, and it looks like full site editing is building as expected :) The lint issue would definitely be annoying though. I tried this solution: import-js/eslint-plugin-import#458 (comment) but Eslint didn't accept it as a valid rule. |
Tested that
Seems there are no options for ignoring specific dependencies, so we'll need to disable the rule individually on each import by adding the |
I feel like there's got to be a better way 😅 That would be a lot of lines to disable!! |
@@ -45,7 +45,7 @@ | |||
"@babel/preset-typescript": "7.3.3", | |||
"@wordpress/babel-plugin-import-jsx-pragma": "2.3.0", | |||
"@wordpress/browserslist-config": "2.3.0", | |||
"@wordpress/dependency-extraction-webpack-plugin": "^1.0.1", | |||
"@wordpress/dependency-extraction-webpack-plugin": "1.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get blocked by eslint issue with removing deps, this change alone could be in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pin this exact version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it the latest? (unless I misunderstand your question?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question was more about removing the ^
- exact version vs. version range.
Not a big deal, it's a dependency that I can't imagine ever being duplicated into a bundle that's shipped to a browser. But the version range allows for deduplication. From memory, I don't think there have been significant changes since 1.0.1
👍 I think this is accurate, I don't believe that package-lock file had any impact with the we install packages at this time, but it does raise an interesting point. We don't have This is something that |
We might be able to improve this behavior with a webpack resolver for the rule: https://github.com/benmosher/eslint-plugin-import#resolvers |
I don't think this breaks any tooling. TypeScript complains that it can't find the types, but it's doing a lot of complaining right now as part of our gradual typing process 🙂 TypeScript might have been able to parse the JSDoc from I don't think we're using npm i -D npm install --save @types/wordpress__{blocks,components,editor,i18n,element} |
There seem to be some regular e2e failures. I'm not sure whether this branch regresses or they were preexisting. |
@sirreal I tried to declare
But then the I could probably fix that with the What kind of bugs did the |
Then we'll have to add them back as dev dependencies at least.
That would make the packages appear in the |
…ct) and pin remaining ones
Upgrade WordPress deps to latest working version and explicitly pin versions to avoid duplicate sub-packages with different versions.
483206e
to
4fc70c7
Compare
@sirreal you're totally right! We don't need lockfiles in But projects in Solvable with Lerna Bootstrap or Yarn Workspaces. Neither is ideal for us I added the package locks for
|
You'll need an app |
Full e2e pass: |
They ensure that packages do declare their I don't know whether we've actually had bugs introduced that needed to be fixed, but I know that is has helped me declare dependencies correctly for packages. |
🤔 are we making this too complicated for ourselves? Should we just use the wp script notation instead, off of the window object? This is what webpack is rewriting this to in the final script. I'd probably prefer that over needing to disable the eslint rule individually on each import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full e2e now seem to be passing, this looks good to me, thanks!
Some interesting questions have come up around the lint rule and the way isolated app dependencies are installed, but they're beyond the scope of this PR.
@@ -45,7 +45,7 @@ | |||
"@babel/preset-typescript": "7.3.3", | |||
"@wordpress/babel-plugin-import-jsx-pragma": "2.3.0", | |||
"@wordpress/browserslist-config": "2.3.0", | |||
"@wordpress/dependency-extraction-webpack-plugin": "^1.0.1", | |||
"@wordpress/dependency-extraction-webpack-plugin": "1.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pin this exact version?
@sirreal what do you think about disabling the We do WordPress JS plugins, which run in a special environment where many imports are externalized. We can figure out the externals configuration (and possibly submit some PRs to the ESLint plugin) in another PR.
@gwwar Using |
Big cleanup of
@wordpress
dependencies in Calypso monorepo:In
full-site-editing
andwpcom-block-editor
, remove@wordpress
dependencies and other dependencies that are externalized by thedependency-extraction-webpack-plugin
(lodash
,jquery
,react
, ...) frompackage.json
. These don't need to be installed innode_modules
, because they are never accessed from there. Keep installing only the deps that are actually bundled (classnames
,debug
). This change also prevents Renovate Bot from submitting nonsensical "pin dependencies" PR like #35216.This PR also removes
full-site-editing/package-lock.json
: it's not needed -- all locking is done in the root of the monorepo.In Calypso, upgrade all
@wordpress
dependencies (we actually bundle them there) to the latest working version (we can't upgrade to the very latest ones because of WordPress/gutenberg#17165). And enumerate them all, even the transitive ones, to ensure that we don't get duplicate copies of packages bundled with different versions.Last but not least, pin the
@wordpress/dependency-extraction-webpack-plugin
. That should make #35216 completely obsolete for now.How to test:
full-site-editing
andwpcom-block-editor
build correctly and work correctly@wordpress
packages.Fixes #35497.