microsoft / vscode-loader

An universal Asynchronous Module Definition (AMD) Loader developed primarily to load VSCode's sources.
Other
170 stars 55 forks source link

Computed insertion point clashing with `next/head` #33

Closed Andarist closed 3 years ago

Andarist commented 3 years ago

We are using Next.js with Monaco editor and I've noticed Monaco's styles disappearing.

TLDR is that next/head is using a little bit quirky~ diffing logic to update <head/> during the client's runtime. Injecting any element in the middle of the elements managed by Next is a risk of weird side-effects

I think there is a potential of improving this in Next and I will probably file an issue there as well but I was wondering if maybe this is something that could be fixed here. Or at least, by raising an issue here, I would satisfy my personal curiosity about those liens of code. I don't exactly see why links would be injected before the last existing link. Is there any particular reason behind this? Could this be changed to just appending to the end of the head? I would be happy to provide a PR for this.

I've been searching for an answer in the git's history but this code is already in the initial commit of this repository.

alexdima commented 3 years ago

I don't remember what the reason was. I pushed on top of your PR to just always append to the end of <head>.

Andarist commented 3 years ago

Aaaaawesome! ❤️ Is there anything needed to get those changes in Monaco or is the whole process automated and it will get in in one of the upcoming releases?

alexdima commented 3 years ago

Done via https://github.com/microsoft/vscode/commit/7de611ff199fff38c56479f06c3c2e2b367608d4