Skip to content
Snippets Groups Projects
Unverified Commit b169db61 authored by Marcus Schiesser's avatar Marcus Schiesser Committed by GitHub
Browse files

refactor: use a function for webpack config (#634)

parent 89a49f4f
No related branches found
No related merge requests found
......@@ -3,13 +3,5 @@
"outputFileTracingIncludes": {
"/*": ["./cache/**/*"]
}
},
"webpack": {
"resolve": {
"alias": {
"sharp$": false,
"onnxruntime-node$": false
}
}
}
}
/** @type {import('next').NextConfig} */
import fs from "fs";
import _ from "lodash";
import webpack from "./webpack.config.mjs";
const nextConfig = JSON.parse(fs.readFileSync("./next.config.json", "utf-8"));
const webpackConfig = _.cloneDeep(nextConfig.webpack);
// webpack config must be a function in NextJS, to use a JSON as config, we merge the settings from next.config.json
nextConfig.webpack = (config) => {
return _.merge(config, webpackConfig);
};
nextConfig.webpack = webpack;
export default nextConfig;
// webpack config must be a function in NextJS that is used to patch the default webpack config provided by NextJS, see https://nextjs.org/docs/pages/api-reference/next-config-js/webpack
export default function webpack(config) {
// See https://webpack.js.org/configuration/resolve/#resolvealias
config.resolve.alias = {
...config.resolve.alias,
sharp$: false,
"onnxruntime-node$": false,
};
return config;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment