-
Notifications
You must be signed in to change notification settings - Fork 27
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
Paste functionality not working #377
Comments
Might be related to microsoft/monaco-editor#4438 |
I confirmed that |
This brings me to the realization that with |
You should ensure that process is properly not defined
We are synchonized on the VSCode releases and not on the editor releases anymore, but they often happen really close in time |
Thanks for explanation. For the time being I'll try to downgrade below the affected versions. Following versions are affected by the issue: "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@=3.2.2",
"vscode": "npm:@codingame/monaco-vscode-api@=3.2.2", |
Are you sure it's an issue for you to not inject |
I'm already injecting new webpack.ProvidePlugin({
process: 'process/browser.js',
}), |
Would it be possible to apply a patch as part of this repo build process? Update: having said that I realize that this repo is not a place to fix upstream bugs |
Found a workaround for this bug by utilizing default webpack new webpack.BannerPlugin({
banner: "globalThis.vscode = { process: Symbol.for('vscode') };",
raw: true, // This is important, it tells webpack to prepend the code as-is.
entryOnly: true // This adds the banner only to the beginning of the bundle.
}),
The above code is prepended before every entry point and we're making sure that downstream projects don't event need to know about this. |
Unfortunately, the library can be used with electron and that change will break it
You seem to considering it as a bug while it's not really a bug. You're not supposed to have a process defined in the browser.
I'm not sure how to manage to make |
I need have the process defined due to other required dependencies withing the dependency tree.
It works because of this code. let nodeProcess: INodeProcess | undefined = undefined;
if (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {
// Native environment (sandboxed)
nodeProcess = $globalThis.vscode.process;
} else if (typeof process !== 'undefined') {
// Native environment (non-sandboxed)
nodeProcess = process;
} Then it goes to if (typeof nodeProcess === 'object') { and finally to: else if (typeof navigator === 'object' && !isElectronRenderer) { ...which is what I want. |
Closing as my issue is not really specific to this repository. Thanks for help! |
Then it's a bug of the other library, or it's not compatible with the browser
I've tried this kind of hacks and I had issues because |
Good point. I need to address the root cause... |
Unfortunately I'm unable to address the root cause because of the fact that AsyncAPI renderer (which I'm using) is using https://github.com/APIDevTools/json-schema-ref-parser. It's using a |
I see no code in https://github.com/APIDevTools/json-schema-ref-parser that uses the process object without checking it before in the browser, what file are you referring to? |
It's only called if window is undefined btw, their documentation mentions webpack fallback but nothing about process |
Yeah, its because I'm using version |
I was able to apply {
test: /@apidevtools\/json-schema-ref-parser\/lib\/util\/url.js$/,
loader: 'imports-loader',
options: {
type: 'commonjs',
imports: ['single process/browser process'],
},
}, Unfortunately this needs to be done by all downstream consumers until I'm able to update the library. |
Note that the issue was fixed in microsoft/vscode@8caaab7 |
@CGNonofr thanks for the notice |
Here is a minimal code to reproduce.
When I render a monaco editor, I've noticed that the paste functionality is not working at all. It's impossible to paste a text to the editor. Probably the code that handles pasting got removed by accident or become part of other codingame service override.
The text was updated successfully, but these errors were encountered: