Uncaught ReferenceError: require is not defined
at index. js:1
index. Index. HTML file js
The following is index.js file
index.JS error
You need to add the following code in the created window: see the first figure for details
webPreferences: {
webSecurity: false, // Cancel cross-domain
nodeIntegration: true, // v5 version requires this line
contextIsolation: false, // v12 version needs to add this line
enableRemoteModule:true // v10 version Turn on remote module
}
Read More:
- [Solved] electron Use remote Error: Cannot read properties of undefined (reading ‘BrowserWindow‘)
- React: How to Solve Web3 import error
- How to Solve Vue3 Import lodash error
- [Solved] electron-vue project error: Object.fromEntries is not a function electron-vue
- How to open a page in a new window by Vue router
- [Solved] Uncaught Error: @electron/remote is disabled for this WebContents
- How to React page to achieve entry and exit animation
- SwiftUI 2.0: How to Import Files into iOS Apps
- [Solved] electron Error: Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
- How to Solve Vue3 jweixin-module Error
- Vue Import element-plus Error: Failed to resolve import “element-pluslibtheme-chalkindex.css“ from “src
- [Chrome]: DevTools failed to load source map… (How to Solve)
- How to Solve VUE Error: Mixed spaces and tabs
- How to Solve Vite package error
- How to Solve Vue cli syntax Close Error
- [Solved] electron project Package Error: spawn exe\dll ENOENT
- [Solved] electron Package and Startup Error: Error: ENOENT: no such file or directory, open ‘xxx/manifest.json‘‘
- Vue: How to Solve Eslint error
- How to Solve Nodejs error: cannot find module ‘. /application’
- How to Solve pinia Error in ts File