When require(path) refers to JS file, error is reported. required is not defined

  node.js, question

As shown in the above figure, it is correct to determine the path. When running, the direct error reporting require is undefined, and it is shown as follows:


I use gulp to manage it. It is no problem to use require in gulpfile.js file. I am Xiao Bai and Kneel to beg, the Great God, help me look at it. Thank you!

The browser does not support native require, you should:

  • Use in conjunction with webpack

  • Js