Comments (12)
Hi,
Thanks for providing that piece of information about the change in defaults. Tomorrow I'll update the code with a change for that configuration change.
from cross-platform-desktop-applications.
Afternoon,
Apologies for the delay. I've added the code change now.
from cross-platform-desktop-applications.
I am getting Uncaught ReferenceError: require is not defined at index.html:16
- index.html:16 has document.write(require('osenv').home());
- I have done npm install osenv --save
from cross-platform-desktop-applications.
Hi @docdayao,
Can you let me know:
- What Chapter and version of the code you are running (the NW.js or Electron example)
- What version of Node.js, and either Electron or NW.js you are running
- On what Operating System, and what version (e.g. Windows 10).
Thanks.
from cross-platform-desktop-applications.
from cross-platform-desktop-applications.
Will take a look shortly.
from cross-platform-desktop-applications.
@docdayao what version of Electron are you running? I am going to try replicating the error with Electron 12.0.4
from cross-platform-desktop-applications.
from cross-platform-desktop-applications.
@docdayao I have figured out the issue.
Electron has made updates to improve the security around running apps. If you want to require Node.js libraries in the renderer process, then you have to pass these parameters to the BrowserWindow
instance on line 17:
mainWindow = new BrowserWindow({
webPreferences: { nodeIntegration: true, contextIsolation: false },
});
The contextIsolation
parameter is the one that was missing. There is more information at this link: https://www.electronjs.org/docs/tutorial/quick-start#nodejs-api
from cross-platform-desktop-applications.
from cross-platform-desktop-applications.
from cross-platform-desktop-applications.
@docdayao You're welcome.
On the second edition, there isn't one planned, but if Manning Publications want a 2nd edition then it will happen.
from cross-platform-desktop-applications.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cross-platform-desktop-applications.