Files

45 lines
1.1 KiB
JavaScript

// @ts-check
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
typescript: {
ignoreBuildErrors: process.env.NEXT_PUBLIC_IGNORE_BUILD_ERROR === "true",
},
eslint: {
ignoreDuringBuilds: process.env.NEXT_PUBLIC_IGNORE_BUILD_ERROR === "true",
},
webpack: (config, { isServer }) => {
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push("pino-pretty", "lokijs", "encoding");
patchWasmModuleImport(config, isServer);
return config;
},
};
function patchWasmModuleImport(config, isServer) {
config.experiments = Object.assign(config.experiments || {}, {
asyncWebAssembly: true,
layers: true,
topLevelAwait: true,
});
config.optimization.moduleIds = "named";
config.module.rules.push({
test: /\.wasm$/,
type: "asset/resource",
});
// TODO: improve this function -> track https://github.com/vercel/next.js/issues/25852
if (isServer) {
config.output.webassemblyModuleFilename = "./../static/wasm/tfhe_bg.wasm";
} else {
config.output.webassemblyModuleFilename = "static/wasm/tfhe_bg.wasm";
}
}
module.exports = nextConfig;