Similar to #759

When we import Dockerode from a TS file
import Docker from "dockerode";
we get this error occasionally:
@homarr/nextjs:dev: 2024-07-27T16:16:53.527Z warn: ⚠ ../../node_modules/ssh2/lib/protocol/crypto.js
@homarr/nextjs:dev: Module not found: Can't resolve './crypto/build/Release/sshcrypto.node' in 'C:\Users\manue\WebstormProjects\homarr\node_modules\ssh2\lib\protocol'
@homarr/nextjs:dev:
@homarr/nextjs:dev: Import trace for requested module:
@homarr/nextjs:dev: ../../node_modules/ssh2/lib/protocol/crypto.js
@homarr/nextjs:dev: ../../node_modules/ssh2/lib/server.js
@homarr/nextjs:dev: ../../node_modules/ssh2/lib/index.js
@homarr/nextjs:dev: ../../packages/api/node_modules/docker-modem/lib/ssh.js
@homarr/nextjs:dev: ../../packages/api/node_modules/docker-modem/lib/modem.js
@homarr/nextjs:dev: ../../packages/api/node_modules/dockerode/lib/docker.js
@homarr/nextjs:dev: ../../packages/api/src/router/docker/docker-singleton.ts
@homarr/nextjs:dev: ../../packages/api/src/router/docker/docker-router.ts
@homarr/nextjs:dev: ../../packages/api/src/root.ts
@homarr/nextjs:dev: ../../packages/api/src/index.ts
@homarr/nextjs:dev: ./src/app/api/trpc/[trpc]/route.ts
Functionality does not seem to be affected, but the warning is annoying.
next.config.mjs
// Importing env files here to validate on build
import "@homarr/auth/env.mjs";
import "./src/env.mjs";
/** @type {import("next").NextConfig} */
const config = {
output: "standalone",
reactStrictMode: true,
/** We already do linting and typechecking as separate tasks in CI */
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
webpack: (config, { isServer }) => {
if (isServer) {
config.module.rules.push({
test: /\.node$/,
loader: "node-loader",
});
}
return config;
},
experimental: {
optimizePackageImports: ["@mantine/core", "@mantine/hooks", "@tabler/icons-react"],
serverComponentsExternalPackages: ["dockerode"],
},
transpilePackages: ["@homarr/ui", "@homarr/notifications", "@homarr/modals", "@homarr/spotlight", "@homarr/widgets"],
images: {
domains: ["cdn.jsdelivr.net"],
},
};
export default config;
We use server side components & the app directory.
Similar to #759
When we import Dockerode from a TS file
we get this error occasionally:
Functionality does not seem to be affected, but the warning is annoying.
next.config.mjs
We use server side components & the app directory.