Skip to content
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

Upgrade webpack to 5.86.0 #50992

Merged
merged 4 commits into from Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -236,14 +236,16 @@
"typescript": "5.1.3",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.74.0",
"webpack": "5.86.0",
"webpack-bundle-analyzer": "4.7.0",
"whatwg-fetch": "3.0.0",
"ws": "8.2.3"
},
"resolutions": {
"webpack": "5.86.0",
"browserslist": "4.20.2",
"caniuse-lite": "1.0.30001406",
"@types/node": "20.2.5",
"@babel/core": "7.18.0",
"@babel/parser": "7.18.0",
"@babel/types": "7.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Expand Up @@ -305,7 +305,7 @@
"vm-browserify": "1.1.2",
"watchpack": "2.4.0",
"web-vitals": "3.0.0",
"webpack": "5.74.0",
"webpack": "5.86.0",
"webpack-sources1": "npm:webpack-sources@1.4.3",
"webpack-sources3": "npm:webpack-sources@3.2.3",
"ws": "8.2.3"
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/build/webpack/loaders/utils.ts
Expand Up @@ -6,7 +6,7 @@ const imageRegex = new RegExp(`\\.(${imageExtensions.join('|')})$`)

export function isClientComponentEntryModule(mod: {
resource: string
buildInfo: any
buildInfo?: any
}) {
const rscInfo = mod.buildInfo.rsc
const hasClientDirective = rscInfo?.isClientRef
Expand Down Expand Up @@ -40,9 +40,9 @@ export function isCSSMod(mod: {

export function getActions(mod: {
resource: string
buildInfo: any
buildInfo?: any
}): undefined | string[] {
return mod.buildInfo.rsc?.actions
return mod.buildInfo?.rsc?.actions
}

export function generateActionId(filePath: string, exportName: string) {
Expand Down
Expand Up @@ -136,8 +136,8 @@ export class ClientReferenceManifestPlugin {

// Collect client requests
function collectClientRequest(mod: webpack.NormalModule) {
if (mod.resource === '' && mod.buildInfo.rsc) {
const { requests = [] } = mod.buildInfo.rsc
if (mod.resource === '' && mod.buildInfo?.rsc) {
const { requests = [] } = mod.buildInfo?.rsc
huozhi marked this conversation as resolved.
Show resolved Hide resolved
requests.forEach((r: string) => {
clientRequestsSet.add(r)
})
Expand All @@ -150,7 +150,7 @@ export class ClientReferenceManifestPlugin {
function getAppPathRequiredChunks() {
return chunkGroup.chunks
.map((requiredChunk: webpack.Chunk) => {
if (SYSTEM_ENTRYPOINTS.has(requiredChunk.name)) {
if (SYSTEM_ENTRYPOINTS.has(requiredChunk.name || '')) {
return null
}

Expand Down Expand Up @@ -265,7 +265,7 @@ export class ClientReferenceManifestPlugin {
}
return null
}),
...(mod.buildInfo.rsc?.clientRefs || []),
...(mod.buildInfo?.rsc?.clientRefs || []),
]
.filter(Boolean)
.flat()
Expand Down
Expand Up @@ -3,11 +3,17 @@
"use strict";

var urlBase = decodeURIComponent(__resourceQuery.slice(1));

/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
var active = options.active;
var module = options.module;
/** @type {import("http").IncomingMessage} */
var response;
var request = (
urlBase.startsWith("https") ? require("https") : require("http")
Expand All @@ -27,6 +33,10 @@ exports.keepAlive = function (options) {
}
}
);

/**
* @param {Error} err error
*/
function errorHandler(err) {
err.message =
"Problem communicating active modules to the server: " + err.message;
Expand Down
Expand Up @@ -9,6 +9,7 @@ if (typeof EventSource !== "function") {
}

var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/** @type {EventSource | undefined} */
var activeEventSource;
var activeKeys = new Map();
var errorHandlers = new Set();
Expand All @@ -19,6 +20,10 @@ var updateEventSource = function updateEventSource() {
activeEventSource = new EventSource(
urlBase + Array.from(activeKeys.keys()).join("@")
);
/**
* @this {EventSource}
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
*/
activeEventSource.onerror = function (event) {
errorHandlers.forEach(function (onError) {
onError(
Expand All @@ -42,6 +47,10 @@ var updateEventSource = function updateEventSource() {
}
};

/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/compiled/babel/bundle.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.