Skip to content
Snippets Groups Projects
Unverified Commit 1ad25451 authored by Thuc Pham's avatar Thuc Pham Committed by GitHub
Browse files

fix: allow onnxruntime in nextjs server side (#59)

parent cfb5257a
No related branches found
Tags v0.1.33
No related merge requests found
......@@ -2,6 +2,7 @@
"experimental": {
"outputFileTracingIncludes": {
"/*": ["./cache/**/*"]
}
},
"serverComponentsExternalPackages": ["sharp", "onnxruntime-node"]
}
}
// 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,
};
config.resolve.fallback = {
aws4: false,
};
// Following lines will fix issues with onnxruntime-node when using pnpm
// See: https://github.com/vercel/next.js/issues/43433
config.externals.push({
"onnxruntime-node": "commonjs onnxruntime-node",
sharp: "commonjs sharp",
});
return config;
}
export default function webpack(config, isServer) {
// See https://webpack.js.org/configuration/resolve/#resolvealias
config.resolve.alias = {
...config.resolve.alias,
sharp$: false,
"onnxruntime-node$": false,
};
config.resolve.fallback = {
aws4: false,
};
......
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