Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vscode-loader with remote content in Electron #12

Open
paul-marechal opened this issue Jul 16, 2018 · 1 comment
Open

Use vscode-loader with remote content in Electron #12

paul-marechal opened this issue Jul 16, 2018 · 1 comment

Comments

@paul-marechal
Copy link

paul-marechal commented Jul 16, 2018

We are currently working on an application running in Electron using the monaco-editor, but some use case requires the displayed Electron content to come from a remote server (over http/s).

Problem is, the loader seems to get lost, as it assumes the environment is Node, yet the resources should be fetched from a remote server.

Did you ever encountered such an issue ? What would be our options here ?

I am thinking about trying to trick the loader into detecting a browser environment, though I am not sure I will be able to do this.


Extra infos: The loader works when the application is running in a browser, but once used within electron the loader gets lost.

@paul-marechal
Copy link
Author

paul-marechal commented Jul 20, 2018

Resolved by modifying the prototype of AMDLoader.Environment so that isNode always return false when the electron-browser window is displaying http(s) content.

        if (isHttp) {
            Object.defineProperty(window.AMDLoader.Environment.prototype, 'isNode', {
                get: () => false
            });
        }

But I feel like this is not the best way to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant