Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
Javascript: importing React from Electron renderer

I am using VSCode on Windows. I have set up a boilerplate ElectronJS app and want to use React for the UI. I have main.js, index.html, preload.js and renderer.js.

I have installed these and other packages (like babel) via npm. I see react and other packages in node_modules/ however I can't figure out how to get React imported.

Here is my project structure

node_modules/
.gitignore
index.html
main.js
preload.js
renderer.js

In my renderer.js file I have done as I see other people demonstrate:

import React from 'react';
import ReactDOM from 'react-dom';

In the Electron app's developer console I see: Uncaught TypeError: Failed to resolve module specifier "react". Relative references must start with either "/", "./", or "../".

So I have switched to:

import React from './node_modules/react'

(In the dev console: Failed to load resource: net::ERR_FILE_NOT_FOUND)

For all of these options (separately!):

import React from './node_modules/react/index.js'
import React from './node_modules/react/umd/react.development.js';
import React from import React from './node_modules/react/cjs/react.development.js';

(because it looks like that file reads a Node environment variable to export up either the Dev or Prod version, so it seemed like it might be my entry point) I get "The requested module ... does not provide an export named 'default'.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This will work:

import * as React from 'react';
import * as ReactDOM from 'react-dom';
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!