try worker-loader in next config

This commit is contained in:
Ryan Di 2025-03-18 21:41:00 +11:00
parent 86e274d304
commit 828b9287c5

View file

@ -1,12 +1,25 @@
/** @type {import('next').NextConfig} */ // next.config.js
const nextConfig = { module.exports = {
distDir: "build", webpack(config, { isServer }) {
typescript: { config.distDir = "build";
// The ts config doesn't work with `jsx: preserve" and if updated to `react-jsx` it gets ovewritten by next js throwing ts errors hence I am ignoring build errors until this is fixed. config.typescript = {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, };
// This is needed as in pages router the code for importing types throws error as its outside next js app config.transpileModules = ["../"];
transpilePackages: ["../"],
};
module.exports = nextConfig; if (!isServer) {
config.module.rules.push({
test: /\.worker\.(js|ts)$/,
use: {
loader: "worker-loader",
options: {
// You can tweak the filename pattern here
filename: "static/chunks/[hash].worker.js",
},
},
});
}
return config;
},
};