-
Notifications
You must be signed in to change notification settings - Fork 33
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
Failing to load vscode-oniguruma wasm (and other files) since 1.80 #186
Comments
I see you are on windows and I've never tested it on that platform, maybe the Regarding the wasm loading issue, did you try to add an alias from |
I don't expect the C:/ part to be a problem, I think the problem is that the wasm is located at Regarding the webpack alias, I'm not sure I'm using the feature correctly, but none of these additions helped: alias: {
// 'vscode-oniguruma/../onig.wasm': resolve(__dirname, './node_modules/vscode-oniguruma/release/onig.wasm'),
// 'vscode-oniguruma/release/onig.wasm': resolve(__dirname, './node_modules/vscode-oniguruma/release/onig.wasm'),
// 'vscode-oniguruma/../onig.wasm': './node_modules/vscode-oniguruma/release/onig.wasm',
// 'vscode-oniguruma/release/onig.wasm': './node_modules/vscode-oniguruma/release/onig.wasm',
// 'vscode-oniguruma/../onig.wasm': 'C:\\<PATH_TO_MY_PROJECT>\\node_modules\\vscode-oniguruma\\release\\onig.wasm',
// 'vscode-oniguruma/release/onig.wasm': 'C:\\<PATH_TO_MY_PROJECT>\\node_modules\\vscode-oniguruma\\release\\onig.wasm',
// 'C:\\<PATH_TO_MY_PROJECT>\\node_modules\\vscode-oniguruma\\release\\onig.wasm': 'vscode-oniguruma/../onig.wasm',
// 'C:\\<PATH_TO_MY_PROJECT>\\node_modules\\vscode-oniguruma\\release\\onig.wasm': 'vscode-oniguruma/release/onig.wasm',
}, |
It seems that webpack fails to resolve I'm not sure how the |
Yeah, it seems like that's the issue. I don't know how much experience you have with webpack, but do you have any other ideas I could try? |
Looking at the bundled code in my browser debugger source tab, I can see the line is transformed into const _onigWasm = new URL('vscode-oniguruma/release/onig.wasm', "file:///C:/<PATH_TO_MY_PROJECT>/node_modules/vscode/dist/service-override/textmate.js").href; So maybe the problem somehow lies with the |
Yes! Adding module.exports = {
module: {
parser: {
javascript: {
url: true,
},
},
},
}; and deleting the .angular folder as suggested in https://stackoverflow.com/a/75252098 seems to have resolved the issue for me. |
both issues? |
Yes, also the .json file loading issue. Thanks! In the issue linked in the answer you linked, they also suggest migrating to esbuild which Angular experimentally supports now. Do you know whether using esbuild is more or less supported by monaco-languageclient and monaco-vscode-api? |
Taking another look at https://github.com/TypeFox/monaco-languageclient-ng-example/blob/main/custom-webpack.config.js I can also see it already includes these lines, but only mentions a 'ttf url loading issue' which I haven't had, so I haven't used those lines. |
@jhk-mjolner sorry I am late to the discussion. I was only aware of the ttf issue being solved by this setting so far. |
I'm not sure. esbuild is used by vite in the demo of this project, we need a small hack to make it work in dev mode: monaco-vscode-api/demo/vite.config.ts Lines 62 to 90 in 40ba45c
|
I can also see that the change to new URL() syntax and the related issues are mentioned in the readme for this repo https://github.com/CodinGame/monaco-vscode-api#troubleshooting |
Is it related to webpack of to the angular cli though? |
Ah, right, it was mostly an Angular specific thing, and if you don't want to include troubleshooting for specific web component frameworks, I guess it shouldn't be added. |
It can still be added in a troubleshooting section, feel free to open an MR ;) |
I thought about what would make sense to write. I could write something only about using Angular and Webpack, but I guess more than In general, I could boil the guidance down to "look at the examples from monaco-languageclient". But I'm not sure how much of the configuration in those examples is needed for this project alone, or even how many people will be using this project without monaco-languageclient. And maybe being dependent on another project/repo for guidance is less than ideal? |
I guess it can be very pragmatic: if you encounter this specific error, here's something you can try (maybe with some hints on the reasons that can cause this: angular-cli) |
i meet something wrong with the same file the bad query of that long URL is to fetch the |
There is something wrong with your vite configuration, the library just includes a |
I've tried upgrading from monaco-languageclient 6.0.3 to the latest 6.4.6, and got several errors in the browser console related to not being allowed to load local resources.
I've tried different versions, and concluded that the error first appears in version 6.3.0 which uses 1.80 of monaco-vscode-api.
Error examples from browser console:
Not allowed to load local resource: file:///C:/<PATH_TO_MY_PROJECT>/node_modules/vscode/dist/service-override/vscode-oniguruma/release/onig.wasm
Not allowed to load local resource: file:///C:/<PATH_TO_MY_PROJECT>/frontend/node_modules/vscode/dist/default-extensions/theme-defaults/light_modern.json
(there's several of this kind of error, about trying to load various theme .json files)And those files rightly aren't there, so webpack can't bundle them and serve them as resources.
The error is thrown from
node_modules\vscode\dist\vscode\vs\workbench\services\textMate\browser\textMateTokenizationFeatureImpl.js
inasync _loadVSCodeOnigurumaWASM()
where it tries to load the path'vscode-oniguruma/../onig.wasm'
I've tried looking at some source code and believe this change might be the culprit: e641ac3 as it was introduced in 1.80, remains in 1.81.7 (latest), and changes how the path to the wasm file is resolved.
Perhaps another similar change in another commit, also introduced in 1.80, might explain the same error for the theme .json file(s)?
I'm using Angular and an
extra-webpack.config.js
file to add webpack configuration and have this part for loading wasm, that worked fine before version 1.80:Is there some configuration I can use, either for monaco-languageclient, monaco-vscode-api or webpack, that can resolve this issue?
Or does it require code changes from your side?
The text was updated successfully, but these errors were encountered: