From 36533ba00ea52677ec5e17f22ba1bc3c7716409b Mon Sep 17 00:00:00 2001 From: Sam Chen Date: Wed, 24 Jul 2024 17:29:24 +0800 Subject: [PATCH 1/2] docs(guides): update alternatives --- src/content/guides/package-exports.mdx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/content/guides/package-exports.mdx b/src/content/guides/package-exports.mdx index 65ef09806b64..8d76c1c1c188 100644 --- a/src/content/guides/package-exports.mdx +++ b/src/content/guides/package-exports.mdx @@ -67,6 +67,20 @@ Example: Here `package/things/apple` might be found in `.../package/good-things/apple` or in `.../package/bad-things/apple`. +W> As of version 5.93.1, webpack's behavior has been updated to align with Node's behavior. It now selects the first valid path without attempting further resolutions and throws an error if the path cannot be resolved. + +For example, given the following configuration: + +```json +{ + "exports": { + ".": ["-bad-specifier-", "./non-existent.js", "./existent.js"] + } +} +``` + +Webpack 5.93.1+ will now throw an error since `non-existent.js` is not found while the previous behavior would have resolved to `existent.js`. + ## Conditional syntax Instead of providing results directly in the `exports` field, From 1ea6e5bc1939820a6147310d0734b66469bdef4c Mon Sep 17 00:00:00 2001 From: Sam Chen Date: Thu, 22 Aug 2024 21:43:41 +0800 Subject: [PATCH 2/2] Apply suggestions from code review --- src/content/guides/package-exports.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/guides/package-exports.mdx b/src/content/guides/package-exports.mdx index 8d76c1c1c188..0fad08243e93 100644 --- a/src/content/guides/package-exports.mdx +++ b/src/content/guides/package-exports.mdx @@ -67,7 +67,7 @@ Example: Here `package/things/apple` might be found in `.../package/good-things/apple` or in `.../package/bad-things/apple`. -W> As of version 5.93.1, webpack's behavior has been updated to align with Node's behavior. It now selects the first valid path without attempting further resolutions and throws an error if the path cannot be resolved. +W> As of version 5.94.0, webpack's behavior has been updated to align with Node's behavior. It now selects the first valid path without attempting further resolutions and throws an error if the path cannot be resolved. For example, given the following configuration: @@ -79,7 +79,7 @@ For example, given the following configuration: } ``` -Webpack 5.93.1+ will now throw an error since `non-existent.js` is not found while the previous behavior would have resolved to `existent.js`. +Webpack 5.94.0+ will now throw an error since `non-existent.js` is not found while the previous behavior would have resolved to `existent.js`. ## Conditional syntax