webpack4 electron-renderer window.criRequest is not a function
See original GitHub issueI 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:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks Andrea, I think the reason why
main
is not recognised by default is thatWebpack4 will read 'browser' field when target is 'electron-renderer'
.According to webpack-pr#6814 and webpack-issue#6811
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):
the issue was reproduced. So I think maybe I bundled it in a wrong way.
Thank you all the same