Client on node: Uncaught ReferenceError: require is not defined

前端 未结 8 1452
遥遥无期
遥遥无期 2020-11-21 07:20

So, I am writing an application with the node/express + jade combo.

I have client.js, which is loaded on the client. In that file I have code that calls

8条回答
  •  粉色の甜心
    2020-11-21 08:06

    This is because require() does not exist in the browser/client-side JavaScript.

    Now you're going to have to make some choices about your client-side JavaScript script management.

    You have three options:

    1. Use
提交回复
热议问题