Next.js Discord

Discord Forum

including webpack config prevents `next build` but works with `next dev`

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Avatar
Northeast Congo LionOP
HI all. I have the following next.config.ts
import type { NextConfig } from "next";
import { WebpackConfigContext } from "next/dist/server/config-shared";

export const nextConfig: NextConfig = {
    output: "export",
    distDir: "out",
    webpack: (config, options: WebpackConfigContext) => {
        console.log(options.webpack.version);
        return config;
    }
};

export default nextConfig;


calling build does not produce my export. but the webpack function is definitely invoked as I see the version output.
strangely though. when I call dev it does produce the output.

2 Replies

Avatar
Himalayan
Remove the distDir.
Avatar
Himalayan
Can you maybe show th error you're facing.