Skip to content

Commit

Permalink
Merge pull request #24593 from nikospapcom/support-next-14
Browse files Browse the repository at this point in the history
Next.js: Support v14.0.0
  • Loading branch information
valentinpalkovic authored Oct 27, 2023
2 parents 1919343 + c91523f commit 7726afc
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 63 deletions.
6 changes: 3 additions & 3 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@
"@types/babel__core": "^7",
"@types/babel__plugin-transform-runtime": "^7",
"@types/babel__preset-env": "^7",
"next": "13.5.4",
"next": "^14.0.0",
"typescript": "^4.9.3",
"webpack": "^5.65.0"
},
"peerDependencies": {
"@next/font": "^13.0.0",
"next": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0",
"@next/font": "^13.0.0|| ^14.0.0",
"next": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"webpack": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/src/images/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const configureImageDefaults = (baseConfig: WebpackConfig): void => {
'next/image': path.resolve(__dirname, './images/next-image'),
};

if (semver.satisfies(version, '^13.0.0')) {
if (semver.satisfies(version, '>=13.0.0')) {
resolve.alias = {
...resolve.alias,
'sb-original/next/legacy/image': require.resolve('next/legacy/image'),
Expand Down
12 changes: 2 additions & 10 deletions code/frameworks/nextjs/src/nextImport/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,11 @@ export function configureNextImport(baseConfig: WebpackConfig) {
const nextJSVersion = getNextjsVersion();

const isNext12 = semver.satisfies(nextJSVersion, '~12');
const isNext13 = semver.satisfies(nextJSVersion, '~13');
const isNextVersionSmallerThan12dot2 = semver.lt(nextJSVersion, '12.2.0');
const isNextVersionSmallerThan13 = semver.lt(nextJSVersion, '13.0.0');

baseConfig.plugins = baseConfig.plugins ?? [];

if (!isNext13) {
baseConfig.plugins.push(
new IgnorePlugin({
resourceRegExp: /next\/legacy\/image$/,
})
);
}

if (!isNext12 || isNextVersionSmallerThan12dot2) {
baseConfig.plugins.push(
new IgnorePlugin({
Expand All @@ -32,7 +23,8 @@ export function configureNextImport(baseConfig: WebpackConfig) {
if (isNextVersionSmallerThan13) {
baseConfig.plugins.push(
new IgnorePlugin({
resourceRegExp: /next\/dist\/shared\/lib\/hooks-client-context$/,
// ignore next/dist/shared/lib/hooks-client-context and next/legacy/image imports
resourceRegExp: /(next\/dist\/shared\/lib\/hooks-client-context|next\/legacy\/image)$/,
})
);
}
Expand Down
98 changes: 49 additions & 49 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3973,72 +3973,72 @@ __metadata:
languageName: node
linkType: hard

"@next/env@npm:13.5.4":
version: 13.5.4
resolution: "@next/env@npm:13.5.4"
checksum: 69c013047371bde6c4dc6d03ec77140059bd4e3db38c1991a8aa8a9c8ce4d1370b98a141145a6f60e23f32ce97a3040b448bfd0455b0d9e5ba6efda8df33c89f
"@next/env@npm:14.0.0":
version: 14.0.0
resolution: "@next/env@npm:14.0.0"
checksum: c43e81dbd162a29a4b380342e416209d69d731e8ced7688d09668ec8196f543e358ed65adad81a26e943c63a293d7a018552f8389b6b1ac95cd0f63f4ef257c0
languageName: node
linkType: hard

"@next/swc-darwin-arm64@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-darwin-arm64@npm:13.5.4"
"@next/swc-darwin-arm64@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-darwin-arm64@npm:14.0.0"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@next/swc-darwin-x64@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-darwin-x64@npm:13.5.4"
"@next/swc-darwin-x64@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-darwin-x64@npm:14.0.0"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@next/swc-linux-arm64-gnu@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-linux-arm64-gnu@npm:13.5.4"
"@next/swc-linux-arm64-gnu@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-linux-arm64-gnu@npm:14.0.0"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-arm64-musl@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-linux-arm64-musl@npm:13.5.4"
"@next/swc-linux-arm64-musl@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-linux-arm64-musl@npm:14.0.0"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard

"@next/swc-linux-x64-gnu@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-linux-x64-gnu@npm:13.5.4"
"@next/swc-linux-x64-gnu@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-linux-x64-gnu@npm:14.0.0"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard

"@next/swc-linux-x64-musl@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-linux-x64-musl@npm:13.5.4"
"@next/swc-linux-x64-musl@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-linux-x64-musl@npm:14.0.0"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard

"@next/swc-win32-arm64-msvc@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-win32-arm64-msvc@npm:13.5.4"
"@next/swc-win32-arm64-msvc@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-win32-arm64-msvc@npm:14.0.0"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@next/swc-win32-ia32-msvc@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-win32-ia32-msvc@npm:13.5.4"
"@next/swc-win32-ia32-msvc@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-win32-ia32-msvc@npm:14.0.0"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard

"@next/swc-win32-x64-msvc@npm:13.5.4":
version: 13.5.4
resolution: "@next/swc-win32-x64-msvc@npm:13.5.4"
"@next/swc-win32-x64-msvc@npm:14.0.0":
version: 14.0.0
resolution: "@next/swc-win32-x64-msvc@npm:14.0.0"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand Down Expand Up @@ -7323,7 +7323,7 @@ __metadata:
fs-extra: "npm:^11.1.0"
image-size: "npm:^1.0.0"
loader-utils: "npm:^3.2.0"
next: "npm:13.5.4"
next: "npm:^14.0.0"
node-polyfill-webpack-plugin: "npm:^2.0.1"
pnp-webpack-plugin: "npm:^1.7.0"
postcss: "npm:^8.4.21"
Expand All @@ -7339,8 +7339,8 @@ __metadata:
typescript: "npm:^4.9.3"
webpack: "npm:^5.65.0"
peerDependencies:
"@next/font": ^13.0.0
next: ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0
"@next/font": ^13.0.0|| ^14.0.0
next: ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
webpack: ^5.0.0
Expand Down Expand Up @@ -23937,20 +23937,20 @@ __metadata:
languageName: node
linkType: hard

"next@npm:13.5.4":
version: 13.5.4
resolution: "next@npm:13.5.4"
dependencies:
"@next/env": "npm:13.5.4"
"@next/swc-darwin-arm64": "npm:13.5.4"
"@next/swc-darwin-x64": "npm:13.5.4"
"@next/swc-linux-arm64-gnu": "npm:13.5.4"
"@next/swc-linux-arm64-musl": "npm:13.5.4"
"@next/swc-linux-x64-gnu": "npm:13.5.4"
"@next/swc-linux-x64-musl": "npm:13.5.4"
"@next/swc-win32-arm64-msvc": "npm:13.5.4"
"@next/swc-win32-ia32-msvc": "npm:13.5.4"
"@next/swc-win32-x64-msvc": "npm:13.5.4"
"next@npm:^14.0.0":
version: 14.0.0
resolution: "next@npm:14.0.0"
dependencies:
"@next/env": "npm:14.0.0"
"@next/swc-darwin-arm64": "npm:14.0.0"
"@next/swc-darwin-x64": "npm:14.0.0"
"@next/swc-linux-arm64-gnu": "npm:14.0.0"
"@next/swc-linux-arm64-musl": "npm:14.0.0"
"@next/swc-linux-x64-gnu": "npm:14.0.0"
"@next/swc-linux-x64-musl": "npm:14.0.0"
"@next/swc-win32-arm64-msvc": "npm:14.0.0"
"@next/swc-win32-ia32-msvc": "npm:14.0.0"
"@next/swc-win32-x64-msvc": "npm:14.0.0"
"@swc/helpers": "npm:0.5.2"
busboy: "npm:1.6.0"
caniuse-lite: "npm:^1.0.30001406"
Expand Down Expand Up @@ -23988,7 +23988,7 @@ __metadata:
optional: true
bin:
next: dist/bin/next
checksum: 0b0bc7fa42844859a0444a79122a48b5e65116c30ce077a3edaaecd7cee1d7925214a659391ae6ecf8dc612869a7a646ab3a1a8aa12d074ff17e3f18c53a2621
checksum: cfb18a72d6e1d875efb1bb3806f9a06551f482c5cb87231e77e179a71d26f3d43700290988ad27e739302bfa7ff8ac8081aafd5456c39a2819fdd315617e5acf
languageName: node
linkType: hard

Expand Down

0 comments on commit 7726afc

Please sign in to comment.