-
Notifications
You must be signed in to change notification settings - Fork 10.3k
feat(gatsby): upgrade webpack to version 5 #29145
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
Conversation
5c485e8 to
b88b8e2
Compare
918e0da to
d34ed57
Compare
d34ed57 to
9e0beb1
Compare
9e0beb1 to
91dbfd3
Compare
0557227 to
ccbf341
Compare
8de46d3 to
3ca3200
Compare
|
Seems like fast-refresh is a bit broken with sourcemaps. We'll fix it while we look at fast-refresh in a follow up |
packages/gatsby/src/utils/__tests__/map-templates-to-static-query-hashes.js
Show resolved
Hide resolved
| for (const [rel, assets] of Object.entries(namedChunkGroup.childAssets)) { | ||
| // @ts-ignore TS doesn't like that assets is not typed and especially that it doesn't know that it's Iterable | ||
| for (const asset of assets) { | ||
| handleAsset(asset, rel) | ||
| } | ||
| } | ||
| // for (const [rel, assets] of Object.entries(namedChunkGroup.childAssets)) { | ||
| // // @ts-ignore TS doesn't like that assets is not typed and especially that it doesn't know that it's Iterable | ||
| // for (const asset of assets) { | ||
| // handleAsset(asset, rel) | ||
| // } | ||
| // } |
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.
new webpack.stats.json don't have childAssets, so:
import(
/* webpackChunkName: "imp-prefetch", webpackPrefetch: true */ `../components/imp-prefetch`
).then(mod => {
mod.wat()
})
import(
/* webpackChunkName: "imp-preload", webpackPreload: true */ `../components/imp-preload`
).then(mod => {
mod.wat2()
})
currently is not genering preload/prefetch scripts in .html files
packages/gatsby/package.json
Outdated
| "scripts": { | ||
| "build": "npm run build:types && npm run build:src && npm run build:internal-plugins && npm run build:rawfiles && npm run build:cjs", | ||
| "postbuild": "node scripts/output-api-file.js && yarn workspace gatsby-admin build", | ||
| "postbuild": "node scripts/output-api-file.js", |
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.
bring back admin
| return webpackError.map(e => transformWebpackError(stage, e)) | ||
| } | ||
|
|
||
| return transformWebpackError(stage, webpackError) |
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.
Follow up: add formatWebpackMessages
| loader: require.resolve(`postcss-loader`), | ||
| options: { | ||
| ident: `postcss-${++ident}`, | ||
| execute: false, |
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.
Try to test with https://github.com/4Catalyzer/astroturf
| return [chunkGroup] | ||
| } | ||
|
|
||
| let chunkGroups: Array<ChunkGroup> = [] |
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.
show exmaple
vladar
left a comment
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.
🚢
pieh
left a comment
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.
Yes, It's okay @wardpeet :)
Description
Upgrade loaders to latest and upgrade webpack dependencies
Documentation
I'll have to write a bit in a changelog & upgrade path
Related Issues
[ch22209]