-
Notifications
You must be signed in to change notification settings - Fork 3
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
STRWEB-4: Update webpack to version 5 #36
Conversation
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
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.
Wow! So excited to see you just grabbed this sucker and went for it! 99% fine to me, but the login screen logo doesn’t load for me and I see
<img alt="..." src="[object Module]">
in the source vs
<img alt="..." src="/img/tenant-assets/opentown-libraries-logo.c96ff678691e1a345321b50941335d81.png">
from folio-snapshot. I see the same behavior whether in a workspace or platform build. Trying to compile a build to an output directory, I get
Module not found: Error: Can't resolve 'postcss-loader' in '/Users/zburke/temp/platform-core'
@JohnC-80, do you recall if there were any webpack-5 specific notes in the post-css work (#31) you did a few weeks ago that now come into play?
These are the only two glitches I've found so far. Nice work!
Edit: additional config details:
$ yarn --version
1.22.11
$ node --version
v16.10.0
platform-core(snapshot)*
$ npm --version
7.24.0
platform-core(snapshot)*
$ uname -a
Darwin LP-C02G8208ML85 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Thanks for trying this out @zburke! Would you mind sharing your workspace setup with me? I will try to checkout Would that be enough? |
@mkuklis, a straight clone of
when serving via |
Yeah, @mkuklis - Thank you for grabbing this bull by the horns. I'm very interested in what federated modules will ultimately be able to do for us. There's been some weirdness with the branding icons in a workspace... I haven't had a chance to look into it yet. The wrong thing getting stringified/stringifying the object when it probably needs to use a key of the object (I suspect). |
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Thank you for your feedback @JohnC-80. You are exactly right! I had to update There is also @zburke I would appreciate if you could give it another try with the most recent changes. Oh I also had to upgrade |
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.
With postcss
v8
et al in place, images are now rendering correctly for me. Impossible to overstate how great this news is! LGTM! 🎉 🎉 🎉
Thank you for your help with testing this @zburke! |
Looks like maaaaybe some CSS stuff still isn't coming through correctly? My localhost is from a workspace with a platform and some stripes libs cloned (all UI apps are just pulled in via the platform). Compare with the folio-snapshot: ** |
Good find @zburke! |
@mkuklis, |
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
@zburke it looks like the issue with colors is related to https://github.com/postcss/postcss-color-function which has been deprecated. There is a PR there to update postcss version postcss/postcss-color-function#60 but it hasn't been merged. I pointed to that fork in There is also a newer lib (by the same author) which changes That lib is maintained and up to date but it looks like If we want to move to https://github.com/csstools/postcss-color-mod-function There are couple places where
I think since this was removed from the css spec perhaps a better alternative would be to refactor these to not use For now I'm leaving @zburke thanks again for catching this! |
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
package.json
Outdated
"postcss-url": "^8.0.0", | ||
"postcss": "^8.3.9", | ||
"postcss-calc": "^8.0.0", | ||
"postcss-color-function": "onigoetz/postcss-color-function", |
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.
For now I'm leaving
postcss-color-function
(from the fork) so we can move forward with the webpack upgrade.
Man, it feels like there just aren't good options here. We have some old (now incompatible) things that are unmaintained/deprecated but actually published, and we have some new forks that provide compatibility but haven't ever been formally published. Using a GitHub fork is a bit nerve-wracking. It's relatively hard to unpublish something from NPM, but it's super easy to remove a repository from GitHub.
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.
Yeah this is just a temporary solution until stripes-components is cleaned up. If you are worry about the fork we can fork it too for now.
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.
But I agree. I think the best would be to take care of the color
right in stripes-components
. Then we could remove postcss-color-function
completely.
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.
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.
@zburke that sounds good to me. I cloned postcss-color-function
to folio-org
just in case the other repo disappears :).
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
yarn run v1.22.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
https://issues.folio.org/browse/STRWEB-4
There are two corresponding PRs:
These will have to be merged after this PR is merged.
Notes:
The biggest struggle with the upgrade was related the way compilation hooks were changed. The hooks object became frozen in webpack 5 (https://webpack.js.org/blog/2020-10-10-webpack-5-release/#hook-object-frozen). The way stripes webpack plugins communicate and the
StripesConfigPlugin
had to be refactored to follow this new pattern.I noticed a nice performance boost from both
stripes build
andstripes serve
. For exampleplatform-complete
builds in half of the time compared to webpack 4. The initialstripes serve
(the first timestripes serve
is executed in a given folder) takes similar time to what we saw in webpack 4 but the followingstripes serve
is about 5x faster.The best way to try it out before this work is merged is to checkout both
stripes-webpack
(STRWEB-4 branch) andstripes-cli
(STCLI-187 branch) into a workspace together with a single ui module and add"webpack": "^5.58.1"
toresolutions
to make sure the correct version is being used (this may not be required).Webpack 5 should open the door to a few nice features:
dependsOn
https://webpack.js.org/configuration/entry-context/#dependencies