-
Notifications
You must be signed in to change notification settings - Fork 6
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
CPP-2230: upgrade to Webpack 5 #1002
base: main
Are you sure you want to change the base?
Conversation
f9f2196
to
c6df9f9
Compare
c6df9f9
to
e13d952
Compare
688ffb5
to
cf18e50
Compare
9fc3c10
to
4be2c43
Compare
hmm. the build is failing because |
not needed in webpack 5
also remove disabling cssnano's reduceInitial because we don't support ie11
…t default browsers `defaults` is browserslist best practice and is slightly more lenient than our current browser support
our browser support long ago outpaced how modern our CSS is, and browsers no longer use vendor prefixes for new features.
4be2c43
to
0b2a87b
Compare
main webpack package ships its own types now
@@ -45,42 +46,21 @@ export class PageKitSassPlugin { | |||
// Disable formatting so that we don't spend time pretty printing | |||
outputStyle: 'compressed', | |||
// Enable Sass to @import source files from installed dependencies | |||
includePaths: ['bower_components', 'node_modules', ...this.includePaths] | |||
includePaths: [ | |||
'bower_components', |
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.
thought: probably safe to remove this as a path at this point 😄
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.
+1
updates Page Kit's Webpack plugins to support Webpack 5. not backwards compatible with Webpack 4; most apps will be able to update without changing their config (although there are some things like
raw-loader
in use that v5 has more modern ways of doing that would be good to adopt).i've tested this with the
kitchen-sink
example andnext-article
and everything seems to be working. it probably warrants more testing. it's a little annoying to link everything together to test locally; as well as the Page Kit packages you need to link the app to Page Kit's installs of at leastwebpack
andreact
/react-dom
.webpack 5 breaking changes apps need to be aware of
exports
specifier inpackage.json
Webpack 5 is strict about not importing things that aren't exported inexports
. this may require code changes in packages and/or apps to export everything that should be and import things correctly.next-article
imports@financial-times/custom-code-component/dist/custom-code-component.js
, but that package doesn't include that entrypoint in itsexports
(it exports.
, the top-level import, pointing that at the filedist/custom-code-component.js
, which isn't visible outside the package).next-article
won't build with Webpack 5 without changing thatimport
to@financial-times/custom-code-component
.spicy changes i'm making in this PR
-webkit
prefixed properties supported by every browser; i have verified via Github search that we never use any of these properties unprefixed. this will eventually allow us to move away from PostCSS, speeding up our builds somewhat.@babel/preset-env
from attempting to codify our browser support to just using Browserslistdefaults
.defaults
is industry best practice, and slightly more lenient than our current browser support policy. this speeds up our build and reduces bundle size (by reducing how much syntax we need to compile), and reduces maintenance burden of updating our Browserslist config when our browser support policy changes.