electron-userland / electron-remote

DEPRECATED: Execute JavaScript in remote Electron processes, but more betterer
MIT License
430 stars 57 forks source link

Uncaught TypeError: request.charCodeAt is not a function #25

Open alexcroox opened 7 years ago

alexcroox commented 7 years ago

I'm not sure if this is a webpack issue, but I'm doing the following:

const fetchProjects = requireTaskPool(require.resolve('./Projects/fetchProjects'))

fetchProjects(this.existingProjects)

./Projects/fetchProjects.js

function fetchProjectsWorker (existingProjects) {

}

module.exports = fetchProjectsWorker

But I get Uncaught TypeError: request.charCodeAt is not a function

Debugging with console.log(require.resolve('./Projects/fetchProjects')) returns 100, so I think that might be the issue?

alexcroox commented 7 years ago

It's definitely an issue with webpack compatibility. But even when I manually put in an absolute path to the module as a string manually, I'm getting "Unexpected token import" (I have import statements at the top of the worker)

wateryoma commented 7 years ago

@alexcroox have you solved this issue?

alexcroox commented 7 years ago

No, turns out it's been confirmed several times by the author he won't support webpack, see denied PR helping to fix it: https://github.com/electron-userland/electron-remote/pull/20

maxkoryukov commented 6 years ago

Probably, one of the maintainers should fix the bug. But what to do right now?

I have a bug, and I know - it is because Webpack eats my import and includes it into the bundle. But Electron-remote expects to load module by itself.

Probably, it is not a big deal for webpack-enlightened guys, but I am not one of them (at least for now), and I don't have 2 hours to find a proper solution.

So guys, if someone has a proper solution - PLEASE SHARE