Just posting an answer, since not everyone reads comments on SO. @Aurora0001 nailed it. Webpack’s config needs to have this set:
"target": "node"
More Related Contents:
- webpack dynamic module loader by require
- How to build minified and uncompressed bundle with webpack?
- In the `import` syntax of ES6, how is a module evaluated exactly?
- Babel 7 – ReferenceError: regeneratorRuntime is not defined
- Webpack: Bundle.js – Uncaught ReferenceError: process is not defined
- Webpack 5 – Uncaught ReferenceError: process is not defined
- Node JS and Webpack Unexpected token
- Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module ‘babel-preset-react’
- How to get access to webpack-dev-server from devices in local network?
- Conflict: Multiple assets emit to the same filename
- How can I use webpack with express?
- Why are functions synchronous in Javascript?
- await is only valid in async function
- nodejs vs node on ubuntu 12.04
- Get data from fs.readFile
- npm – EPERM: operation not permitted on Windows
- Connecting to TCP Socket from browser using javascript
- Axios Http client – How to construct Http Post url with form params
- node.js shell command execution
- How to set NODE_ENV to production/development in OS X
- Npm install cannot find module ‘semver’
- How to generate an MD5 file hash in JavaScript/Node.js?
- Node.js variable declaration and scope
- Mongoose difference between .save() and using update()
- Node.js Port 3000 already in use but it actually isn’t?
- Node.js Alert Causes Crash
- Webpack bundles my files in the wrong order (CommonsChunkPlugin)
- how express forming the img URL
- Is there a way to “require” a JS file only once in nodejs?
- Group by Date with Local Time Zone in MongoDB