-
Notifications
You must be signed in to change notification settings - Fork 136
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
WordPress Scripts Upgrade #728
Conversation
this commit fixes 175 and is temporary until the fix is merged back into `master`
Everything seems to be good here, except when I run
The debug log offers this info:
Is this anything you've run into before? |
@coreymcollins Ah, looks like you're using NPM 5. Please upgrade to NPM 7 ( |
Was finally able to resolve my weird |
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.
Doing some final testing before a manual merge of this to resolve the conflicts, I noticed two things that I hadn't before.
- CSS sourcemaps don't seem to be working anymore when running
watch
/dev
orstart
. Instead, everything points toindex.css
instead of the individual partials. - A few SVG images are getting dropped into the top-level
/build/
directory when I build. Screenshot below of what I'm seeing in my build folder. This happens when running anybuild
/watch
/dev
/start
.
Digging into the SVG image thing some more, I've found this: The 3 SVGs that are being dumped into the top-level This is weird! Also something that isn't happening on the current |
I think I've been able to track the SVG problem down to If I revert back to the current wd_s version of Going to look into what changed in the versions since 5.2.6 and if there's some option to set to keep this from happening. Edit: this isn't specific to SVGs, just as a heads up. We just only happen to be using SVGs as backgrounds in our partials, but if you use a PNG or JPG it will also do the same thing of creating a version of that image in the build directory. |
So it looks like I've updated per the instructions here: https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md (which points to https://webpack.js.org/guides/asset-modules/) Running into a hiccup with fonts, but images are working as expected now. |
Got it! That latest commit should resolve the duplicate SVG issue and replace the loader used for fonts. |
At this point, the remaining issue is with sourcemaps. I'll try and dig into that today as well. |
Okay! I think the above two commits solve the sourcemap issue. I had to bump Could use some testing to be sure, but this seems to be working on my end. |
# Conflicts: # package-lock.json # package.json
@coreymcollins I was final able to resolve the merge conflict! |
Excellent! If everything else works as expected for you here, I can give this the ole 👍🏻 and merge this sucker in. |
@coreymcollins My testing this morning was weird. If I made a change to a Sass partial one-folder deep, Webpack would compile everything fine...but, if I made a change to a Sass partial two-folders deep, it wouldn't see the change and nothing recompiled. I found this PR WordPress/gutenberg#34264 which addresses the issue. So I bumped @wordpress/scripts to |
Ooh, nice catch! If everything else is looking good from your testing, I'll go ahead and merge this in this morning. Thanks! |
Closes #731
DESCRIPTION
@wordpress/scripts now supports Webpack 5, which means we can finally upgrade some very outdated packages and use PostCSS 8!
Here are the Node dependencies that were upgraded:
Other
This was appearing in the terminal and is coming from the
svg-spritemap
plugin. It's bug #175. The plugin author has committed a fix directly tomaster
, but has yet to release it under semver.I've slapped a band-aid on this by pointing our
package.json
file directly at the commit hash with the fix. This is fugly, but works, and should be considered a temporary until the fix is actually released and properly semver'd.I've also updated
composer
dependencies and adjusted thewebpack.config
files to use Webpack 5 shape and syntax.SCREENSHOTS
Front-end:
Build:
STEPS TO VERIFY
How do we test this?
gh pr checkout 728
npm ci
npm run build
npm run dev
npm run lint
npm run format