From 88ef4e2d63b1121fdf6217969f3761115f800c8f Mon Sep 17 00:00:00 2001 From: fly6516 Date: Thu, 27 Feb 2025 09:53:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Afix=20errors=20in=20console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.ts | 12 +----------- package.json | 2 +- src/app/layout.tsx | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/next.config.ts b/next.config.ts index 7ea9c4f..497ffa7 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,17 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ - webpack(config, { isServer }) { - // 仅在服务器端处理 .node 文件 - if (isServer) { - config.module.rules.push({ - test: /\.node$/, - use: 'node-loader', // 使用 node-loader 处理 .node 文件 - }); - } - return config; - }, + serverExternalPackages: ["dockerode"], }; export default nextConfig; diff --git a/package.json b/package.json index 424c613..aaaa082 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "axios": "^1.7.9", "dockerode": "^4.0.2", "next": "15.1.3", + "nextjs-node-loader": "^1.1.9", "react": "^19.0.0", "react-dom": "^19.0.0" }, @@ -29,7 +30,6 @@ "eslint-config-next": "15.1.3", "html-webpack-plugin": "^5.6.3", "jest": "^29.7.0", - "node-loader": "^2.1.0", "postcss": "^8", "tailwindcss": "^3.4.1", "ts-jest": "^29.2.5", diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f7fa87e..e9454a2 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -23,7 +23,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - +