Just posting an answer, since not everyone reads comments on SO. @Aurora0001 nailed it. Webpack’s config needs to have this set:
"target": "node"
Related Contents:
- webpack dynamic module loader by require
- In the `import` syntax of ES6, how is a module evaluated exactly?
- How to build minified and uncompressed bundle with webpack?
- Babel 7 – ReferenceError: regeneratorRuntime is not defined
- Webpack: Bundle.js – Uncaught ReferenceError: process is not defined
- When is .then(success, fail) considered an antipattern for promises?
- module.exports vs exports in Node.js
- SyntaxError: Cannot use import statement outside a module
- How do I fix CLIENT_MISSING_INTENTS error?
- Callback after all asynchronous forEach callbacks are completed
- How to run Gulp tasks sequentially one after the other
- Is “.then(function(a){ return a; })” a no-op for promises?
- How to create an HTTPS server in Node.js?
- Electron require() is not defined
- ES6 variable import name in node.js?
- Difference between microtask and macrotask within an event loop context
- Render basic HTML view?
- Nodejs Event Loop
- Rails – Could not find a JavaScript runtime?
- Write / add data in JSON file using Node.js
- Failed to load c++ bson extension
- How to search in array of object in mongodb
- How to stop babel from transpiling ‘this’ to ‘undefined’ (and inserting “use strict”)
- Scaling Socket.IO to multiple Node.js processes using cluster
- Javascript ES6 TypeError: Class constructor Client cannot be invoked without ‘new’
- Converting a Buffer into a ReadableStream in Node.js
- How to request the Garbage Collector in node.js to run?
- javascript – Why is there a spec for sync and async modules?
- Using filesystem in node.js with async / await
- dotenv file is not loading environment variables
- Load and execute external js file in node.js with access to local variables?
- stop all instances of node.js server
- Puppeteer log inside page.evaluate
- How to add custom html attributes in JSX
- Pattern for CoffeeScript modules [duplicate]
- XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3000’ Google maps
- Download text/csv content as files from server in Angular
- Webpack and external libraries
- Querying by a field with type ‘reference’ in Firestore
- Can I determine if a string is a MongoDB ObjectID?
- Using require(‘…’) with a variable vs. using a string in webpack
- What exactly is Hot Module Replacement in Webpack?
- How to make Puppeteer work with a ReactJS application on the client-side
- How can I fix the “BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default" error?
- Why is process.env.NODE_ENV undefined?
- Calculating the shortest route between two points
- How to structure nested Promises
- Node.js POST causes [Error: socket hang up] code: ‘ECONNRESET’
- `this` is undefined in Dev Tools when using arrow function
- “unexpected token import” in Nodejs5 and babel?