Skip to content

Commit

Permalink
Merge pull request #244 from xmtp/rygine/update-nextjs-example
Browse files Browse the repository at this point in the history
Update Next.js example
  • Loading branch information
rygine authored Jun 26, 2024
2 parents 1a751f6 + 1b79953 commit 86aafee
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 84 deletions.
36 changes: 4 additions & 32 deletions examples/nextjs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
import CopyPlugin from "copy-webpack-plugin";

/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer, dev }) => {
experimental: {
serverComponentsExternalPackages: ["@xmtp/user-preferences-bindings-wasm"],
},
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
if (isServer) {
if (!dev) {
config.plugins.push(
new CopyPlugin({
patterns: [
{
context: ".next/server",
to: "./app/[name][ext]",
from: "../../../../node_modules/@xmtp/user-preferences-bindings-wasm/dist/node",
filter: (resourcePath) => resourcePath.endsWith(".wasm"),
},
],
}),
);
} else {
config.plugins.push(
new CopyPlugin({
patterns: [
{
context: ".next/server",
to: "./vendor-chunks/[name][ext]",
from: "../../../../node_modules/@xmtp/user-preferences-bindings-wasm/dist/node",
filter: (resourcePath) => resourcePath.endsWith(".wasm"),
},
],
}),
);
}
}
return config;
},
};
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@tanstack/react-query": "^5.28.0",
"@wagmi/core": "^2.6.6",
"@xmtp/react-app": "workspace:*",
"next": "14.1.3",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18",
"viem": "^2.7.15",
Expand Down
113 changes: 62 additions & 51 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2688,72 +2688,72 @@ __metadata:
languageName: node
linkType: hard

"@next/env@npm:14.1.3":
version: 14.1.3
resolution: "@next/env@npm:14.1.3"
checksum: 10/b95c55530f5fb8cfb2a48a23485fd4cb584bff8620637785d7dd068c0d72d4dc0869023ed509f52fead558839f2efae4f7370a2c2fd87540201629fc39a421a5
"@next/env@npm:14.2.4":
version: 14.2.4
resolution: "@next/env@npm:14.2.4"
checksum: 10/1f48bd96dd92a98b8e7ccfbd494f5893174721cb164dfda898728db37c0413fe0ca71872c1c7c56a46419a417137bc3aaa3e53543f938bea14589f68474bfd73
languageName: node
linkType: hard

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

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

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

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

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

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

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

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

"@next/swc-win32-x64-msvc@npm:14.1.3":
version: 14.1.3
resolution: "@next/swc-win32-x64-msvc@npm:14.1.3"
"@next/swc-win32-x64-msvc@npm:14.2.4":
version: 14.2.4
resolution: "@next/swc-win32-x64-msvc@npm:14.2.4"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand Down Expand Up @@ -3995,12 +3995,20 @@ __metadata:
languageName: node
linkType: hard

"@swc/helpers@npm:0.5.2":
version: 0.5.2
resolution: "@swc/helpers@npm:0.5.2"
"@swc/counter@npm:^0.1.3":
version: 0.1.3
resolution: "@swc/counter@npm:0.1.3"
checksum: 10/df8f9cfba9904d3d60f511664c70d23bb323b3a0803ec9890f60133954173047ba9bdeabce28cd70ba89ccd3fd6c71c7b0bd58be85f611e1ffbe5d5c18616598
languageName: node
linkType: hard

"@swc/helpers@npm:0.5.5":
version: 0.5.5
resolution: "@swc/helpers@npm:0.5.5"
dependencies:
"@swc/counter": "npm:^0.1.3"
tslib: "npm:^2.4.0"
checksum: 10/3a3b179b3369acd26c5da89a0e779c756ae5231eb18a5507524c7abf955f488d34d86649f5b8417a0e19879688470d06319f5cfca2273d6d6b2046950e0d79af
checksum: 10/1c5ef04f642542212df28c669438f3e0f459dcde7b448a5b1fcafb2e9e4f13e76d8428535a270e91ed123dd2a21189dbed34086b88a8cf68baf84984d6d0e39b
languageName: node
linkType: hard

Expand Down Expand Up @@ -5473,7 +5481,7 @@ __metadata:
copy-webpack-plugin: "npm:^12.0.2"
eslint: "npm:^8.57.0"
eslint-config-xmtp-web: "workspace:*"
next: "npm:14.1.3"
next: "npm:14.2.4"
prettier: "npm:^3.2.5"
react: "npm:^18"
react-dom: "npm:^18"
Expand Down Expand Up @@ -13030,28 +13038,29 @@ __metadata:
languageName: node
linkType: hard

"next@npm:14.1.3":
version: 14.1.3
resolution: "next@npm:14.1.3"
"next@npm:14.2.4":
version: 14.2.4
resolution: "next@npm:14.2.4"
dependencies:
"@next/env": "npm:14.1.3"
"@next/swc-darwin-arm64": "npm:14.1.3"
"@next/swc-darwin-x64": "npm:14.1.3"
"@next/swc-linux-arm64-gnu": "npm:14.1.3"
"@next/swc-linux-arm64-musl": "npm:14.1.3"
"@next/swc-linux-x64-gnu": "npm:14.1.3"
"@next/swc-linux-x64-musl": "npm:14.1.3"
"@next/swc-win32-arm64-msvc": "npm:14.1.3"
"@next/swc-win32-ia32-msvc": "npm:14.1.3"
"@next/swc-win32-x64-msvc": "npm:14.1.3"
"@swc/helpers": "npm:0.5.2"
"@next/env": "npm:14.2.4"
"@next/swc-darwin-arm64": "npm:14.2.4"
"@next/swc-darwin-x64": "npm:14.2.4"
"@next/swc-linux-arm64-gnu": "npm:14.2.4"
"@next/swc-linux-arm64-musl": "npm:14.2.4"
"@next/swc-linux-x64-gnu": "npm:14.2.4"
"@next/swc-linux-x64-musl": "npm:14.2.4"
"@next/swc-win32-arm64-msvc": "npm:14.2.4"
"@next/swc-win32-ia32-msvc": "npm:14.2.4"
"@next/swc-win32-x64-msvc": "npm:14.2.4"
"@swc/helpers": "npm:0.5.5"
busboy: "npm:1.6.0"
caniuse-lite: "npm:^1.0.30001579"
graceful-fs: "npm:^4.2.11"
postcss: "npm:8.4.31"
styled-jsx: "npm:5.1.1"
peerDependencies:
"@opentelemetry/api": ^1.1.0
"@playwright/test": ^1.41.2
react: ^18.2.0
react-dom: ^18.2.0
sass: ^1.3.0
Expand All @@ -13077,11 +13086,13 @@ __metadata:
peerDependenciesMeta:
"@opentelemetry/api":
optional: true
"@playwright/test":
optional: true
sass:
optional: true
bin:
next: dist/bin/next
checksum: 10/6e77d5d35161b1e9337112ce7864527029f5c8e25ddd29e07e8a730c83f7241dd241e7eb0bdcd006e813b610274e960e0af18c167ab8a2deeeb7776121a7d770
checksum: 10/5bf2ccb4c6b0076a61b875a1112d34a31f5afc9d5f2676acf6c8151b425c38d289b951de70b598ad6ed9fa6be5fa3c215d1d9b462ba2b72075cb80501fd9fd07
languageName: node
linkType: hard

Expand Down

0 comments on commit 86aafee

Please sign in to comment.