Code Monkey home page Code Monkey logo

Comments (12)

paulbjensen avatar paulbjensen commented on May 18, 2024

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.

paulbjensen avatar paulbjensen commented on May 18, 2024

Afternoon,

Apologies for the delay. I've added the code change now.

from cross-platform-desktop-applications.

docdayao avatar docdayao commented on May 18, 2024

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.

paulbjensen avatar paulbjensen commented on May 18, 2024

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.

docdayao avatar docdayao commented on May 18, 2024

from cross-platform-desktop-applications.

paulbjensen avatar paulbjensen commented on May 18, 2024

Will take a look shortly.

from cross-platform-desktop-applications.

paulbjensen avatar paulbjensen commented on May 18, 2024

@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.

docdayao avatar docdayao commented on May 18, 2024

from cross-platform-desktop-applications.

paulbjensen avatar paulbjensen commented on May 18, 2024

@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.

docdayao avatar docdayao commented on May 18, 2024

from cross-platform-desktop-applications.

docdayao avatar docdayao commented on May 18, 2024

from cross-platform-desktop-applications.

paulbjensen avatar paulbjensen commented on May 18, 2024

@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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.