Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack4 electron-renderer window.criRequest is not a function

See original GitHub issue

I use chrome-remote-interface in electron render process, like this:

const CDP = require('chrome-remote-interface');
CDP.List(options, callback)

when bundled with webpack3 , everything is ok. But when I upgraded webpack to wepack 4, I got an error:

window.criRequest is not a function

I know it’s for browser usage, but I want to run in node. Is it a problem with webpack or Did I miss something?

| webpack | 4.21.0 | webpack-target | electron-renderer | Operating system | Mac | Node.js | v10.7.0 | chrome-remote-interface | 0.25.7 | electron | 2.0.10"

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

fishearcommented, Nov 2, 2018

Done, let me know if you figure out why main is not recognised by default.

Thanks Andrea, I think the reason why main is not recognised by default is that

Webpack4 will read 'browser' field when target is 'electron-renderer'.

According to webpack-pr#6814 and webpack-issue#6811

fishearcommented, Oct 22, 2018

I’m not familiar with Electron, can you provide a minimal application so I can try?

Thanks very much and sorry for the late reply. I found it a prolem with myself. I tried to provide a simply demo with electron-vue, and there was no prolem. ^^ And I remove the externals in webpack.config.js, like this(‘chrome-remote-interface’ is in the dependencies):

//   externals: [
//     ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
//   ],

the issue was reproduced. So I think maybe I bundled it in a wrong way.

Thank you all the same

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Electron window.require is not a function even with ...
Use a module to override webpack config: I used craco to set target to electron-renderer. It results in a blank page when I...
Read more >
Installation | webpack
This guide goes through the various methods used to install webpack. Prerequisites. Before we begin, make sure you have a fresh version of...
Read more >
Building a desktop app with electron, webpack and redux
A step-by-step guide to building a desktop app with lessons and takeaways from the Fluent Conference in San Francisco.
Read more >
ioHook + Electron + Webpack integration | by Ievgenii Spitsyn
Note that the problem and solution below are relevant ONLY for using ioHook in Electron's renderer context. Although possible, this is not ......
Read more >
Troubleshooting | Amplify UI for React
Uncaught ReferenceError: process is not defined. Webpack 4 already includes this polyfill. ... window.URL.createObjectURL is not a function.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found