Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

How to use sqlite or sequelize or typeorm on react side? #14

Answered by MPMcIntyre
leopucci asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @leopucci

Generally it is not considered good practice to allow node modules to be accessed on the renderer (react) side as it allows for cross-site-scripting (XSS) attacks, however, it is possible by allowing it on the window.

You would do this by changing the settings on the webPreferences as such:

  webPreferences: {
    preload: preloadFilePath,
    //!security
    nodeIntegration: true, //unsecure
    contextIsolation: false, // unsecure
    enableRemoteModule: true, // unsecure
  },

so a new window would look like this:

const win = new BrowserWindow({
  width: 800,
  height: 600,
  webPreferences: {
    preload: preloadFilePath,
    //!security
    nodeIntegration: true,
    con…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@leopucci
Comment options

Answer selected by leopucci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants