Below is the error me and my team is facing while creating build.
Error :-
Error: Dynamic require of "child_process" is not supported
at file:///app/node_modules/@builder.io/dev-tools/node/index.mjs:1:383
at file:///app/node_modules/@builder.io/dev-tools/node/index.mjs:8:58753
at file:///app/node_modules/@builder.io/dev-tools/node/index.mjs:1:459
at file:///app/node_modules/@builder.io/dev-tools/node/index.mjs:104:1662
at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async loadConfig (/app/node_modules/next/dist/server/config.js:711:36)
at async Module.nextDev (/app/node_modules/next/dist/cli/next-dev.js:175:14)
this is builder specific error which due to @builder.io/dev-tools
which is using child_process
which is Nodejs core module.
anyone have idea how we can fix this ?
we have already tried below approch modifying next.config.mjs
file.
module.exports = {
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
child_process: false, // Mock 'child_process'
};
}
return config;
},
};