CodinGame / monaco-vscode-api

VSCode public API plugged on the monaco editor
MIT License
214 stars 29 forks source link

vsixPlugin broken >=1.85.3 #321

Closed kevinvalk closed 6 months ago

kevinvalk commented 6 months ago

Pre 1.85.3 I was using the vsixPlugin to import vsix extensions (and enable them) in one fell swoop (which worked wonderful)!

import './mathiasfrohlich.Kotlin-1.7.1.vsix';
import './sdras.night-owl-2.0.1.vsix';
import './tamasfe.even-better-toml-0.19.1.vsix';

Post 1.85.3 the extensions are completely missing from the builds (dev and build).

I did a double take, using vite build. Pre 1.85.3 the following is present in the dist/assets directory. While post 1.85.3 I cannot find any files related to the extensions. image

kevinvalk commented 6 months ago

So quick update to ensure we do not spent time doing the same thing.

In 1.85.3 the rollup plugin does emit the registerExtension code, but somehow it does not include any files from the extension (in my case). I added some debugging info to the resources variable which in all three of my vsix files are empty. https://github.com/CodinGame/monaco-vscode-api/blob/86990ebacb72660fb0e5eb976fd9fe9c6d4baf67/src/rollup-vsix-plugin.ts#L84-L88

The only thing that really changed is the glob pattern compared to before, so not sure what is going wrong here...

kevinvalk commented 6 months ago

I think I found the problem.

Pre 1.85.3 the code was: https://github.com/CodinGame/monaco-vscode-api/blob/11cd928bca5848ada41df760ae6f17df9b3844be/src/rollup-vsix-plugin.ts#L96-L100

Post 1.83.4 the code is: https://github.com/CodinGame/monaco-vscode-api/blob/86990ebacb72660fb0e5eb976fd9fe9c6d4baf67/src/rollup-vsix-plugin.ts#L84-L88

So the cwd got changed from '/' to id and I do not see how that could work to be honest. However I am confused to why #322 is not having any issues with bundling... Anyways, if I restore the cwd back to '/', the build works again and all missing files are bundled nicely.

@CGNonofr can you verify if this is indeed a bug and if so fix the cwd?

P.S. For now you can also "just" use "@codingame/monaco-vscode-rollup-vsix-plugin": "1.85.2", in you package.json file.

CGNonofr commented 6 months ago

Indeed, it was a mistake while refactoring those rollup plugins. Do you mind opening a PR ?

Thank you for the investigations