Client on node: Uncaught ReferenceError: require is not defined

前端 未结 8 1487
遥遥无期
遥遥无期 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条回答
  •  旧时难觅i
    2020-11-21 08:20

    This Worked For Me

    1. Save this file https://requirejs.org/docs/release/2.3.5/minified/require.js. It is the file for RequestJS which is what we will use.
    2. Load into your HTML like this

    Note!
    use require(['moudle-name']) in your-script.js
    not require('moudle-name')
    use const {ipcRenderer} = require(['electron'])
    not const {ipcRenderer} = require('electron')

提交回复
热议问题