New monaco-vscode-api / vite 8 beta 12 + esbuild-import-meta-url-plugin removal#1017
New monaco-vscode-api / vite 8 beta 12 + esbuild-import-meta-url-plugin removal#1017
Conversation
|
CC @cpojer regarding |
|
Isn't the issue that |
ad30e0d to
1d6f6a2
Compare
Something like that yes! But is Old vite (before vite 8 beta.11) did not load sub-module exports properly (e.g. workers) and also there were issues with VS Code theme resources not being resolved. This is all working now. |
If
I'm not sure what you mean by any of the suggestion 🤔 Also inlining the wasm is a shame since it's pretty big and the inlining (in base64 I guess) with add a ~30% overhead |
Yeah, inlining is not a good idea. What I don't understand is why vscode-oniguruma ships the wasm, but only provides a method(s) to load a buffer. Why don't they provide a method for loading what is contained (like What I meant is to contain
It would be a valid if defined as sub-export, wouldn't it? Like you do with the workers. Or does vite treat js differently than wasm with regard to URL resolution? |
They have the same problem as ours, how do you expect them to load it?
That's concerning 🤔 probably not
One solution is to make vscode-textmate and oniguruma as internal in the monaco-vscode-api rollup config indeed 🤔 it's probably a good idea as no one will likely be using it by hands anyway 🤔 OR publish both packages:
vscode-oniguruma doesn't define any sub-export so you are able to import any file in it by its path |
If this removes pain points with bundlers I vote for such a solution. We don't need different packages, IMO. Also, |
|
CodinGame/monaco-vscode-api#764 should make it |
Hum no, not working yet 🤔 |
1d6f6a2 to
238e45a
Compare
|
@CGNonofr awesome work. I confirm it is working nicely now. |
|
@CGNonofr this is ready now |
@CGNonofr
vite@8.0.0-beta.11handlesimport.meta.urlproperly now. Two related issues remain that I want to discuss with you. The problem may be resolved in monaco-vscode-api.On this branch I disabled
@codingame/esbuild-import-meta-url-pluginand the following two files are problematic as far as I can see. I manually changed the import to see if I can make it work (see commented code and following line). When this is in place all test pass and textmate / highlighting is working properly afterwards.The following files are problematic:
@codingame/monaco-vscode-textmate-service-override/vscode/src/vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl.jsll. 313 following:@codingame/monaco-vscode-textmate-service-override/vscode/src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.jsll. 109 following:import.meta.urlrefers to the js file and therefore the url is wrongly resolved by vite without the change. The problem is that a non-exported sub-package / file is tried to be loaded. That is actually fishy. I know you already changed that with a patch from what originally is done by VS Code.Wouldn't it be best if
vscode-oniguramasupplies a function that allows to load or just supply the bundled onig.wasm? I don't know the reason why there is no such utility.Referring to another node_module by a relative path (like I did) is not a good solution, I know. Can't we do that on our level? Or just copy the file to
@codingame/monaco-vscode-textmate-service-override, so we can control it / expose a utility functions that ensure proper loadingonig.wasminto an array buffer? Do you have other ideas?