To solve the “ReferenceError require is not defined” error, use the ES6 module import and export syntax . The require() function is Node. js specific and is not supported in the browser. You can use the ES6 Module import / exports syntax in the browser.