monaco-editor version: 0.21.0
Browser: Safari Version 14.0 (15610.1.28.1.9, 15610)
OS: MacOS Catalina
Hello team,
Hesitating to report this in vscode, but because vscode runs in a recent webkit not sure it's an issue.
Some languages use unsupported regex that breaks Safari. dart for example.
You can reproduce by going to the playground and pick "dart" languages.
It will throw an error in the console SyntaxError: Invalid regular expression: invalid group specifier name
Best Regards
I also experienced this. For example :
monaco.editor.create(document.getElementById("container"), {
value: "",
language: "dart"
});

Not a fix, but for anyone using the webpack plugin and experiencing this issue(assuming you don't need dart), one quick fix is to :
new MonacoWebpackPlugin({
languages : []
})
Which comes with other benefits
Anyone know how to fix this? Or which languages are affected?
I think only the dart language uses the regex. In the meantime I have used yeikel鈥檚 solution until a proper fix. Excluding only dart fixes my build.
This is quite insidious in my case because I use webpack and the invalid regex causes the whole chunk to fail parsing in safari. It broke my whole app :/
Forgot to share how I fixed it temporarly:
const monacoLanguages = ['javascript', 'json', 'typescript', 'html'];
[...]
rules: [
{
test: new RegExp(`basic-languages\/(?!${monacoLanguages.join('|')}|_|monaco|fillers)`),
use: 'null-loader',
}
],
[...]
plugins: [
new MonacoWebpackPlugin({
languages: monacoLanguages,
}),
]
Thank you both, that did it!
Here is the problematic regex -- https://github.com/microsoft/monaco-languages/blob/be30e69ac268f58777a4f89a35ee9ceee28ce0f9/src/dart/dart.ts#L184
Fixed via microsoft/monaco-languages#121
Can you update the NPM package as soon as possible?