Turbopack resolve fallback?
Answered
Dutch Shepherd posted this in #help-forum
Dutch ShepherdOP
What's there equivalent of the following code snippet (next.config.js) for Turboback in order to exclude certain Node.js core modules from the client-side browser environment?
I really have to exclude
Otherwise I'm forced to stick with Webpack (which works with the above config), lol.
const config = {
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
};
}
config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /pino-pretty/,
})
);
return config;
},
};
export default config;I really have to exclude
fs, net, and tls from my Next.js app since Turbopack throws errors such as:module not found: can't resolve 'fs'Otherwise I'm forced to stick with Webpack (which works with the above config), lol.
Answered by Dutch Shepherd
I've found the solution in: https://turbo.build/pack/docs/features/customizing-turbopack
This are experimental options I used in my
This are experimental options I used in my
next.config.js in order to resolve the issue:const config = {
experimental: {
turbo: {
resolveAlias: {
tls: "node:tls",
net: "node:net",
fs: "node:fs",
},
},
},
};
export default config;1 Reply
Dutch ShepherdOP
I've found the solution in: https://turbo.build/pack/docs/features/customizing-turbopack
This are experimental options I used in my
This are experimental options I used in my
next.config.js in order to resolve the issue:const config = {
experimental: {
turbo: {
resolveAlias: {
tls: "node:tls",
net: "node:net",
fs: "node:fs",
},
},
},
};
export default config;Answer