I'm trying to bundle a Node script so users don't have to run npm install before using it.
npx webpack runs fine and without warnings, but node dist/main.js gives the following error: Error: Cannot find module 'node:process'.
If I edit dist/main.js and comment out the line about node:process, the bundled script seems to run just fine.
Here's my webpack config:
export default {
target: 'node',
mode: 'development',
output: {
module: true,
chunkFormat: 'module',
filename: 'main.js'
},
experiments: {
topLevelAwait: true,
outputModule: true
}
};