Monaco-editor uses codicon.ttf
font for some icons:
@font-face {
font-family: "codicon";
src: url(./codicon.ttf) format("truetype");
}
Unfortunately, this path is not configurable and it leads to 404 error in my case.
I've created an application/library where monaco-editor is integrated. Everything is bundled by Webpack and my-app.bundle.js
is hosted on remote server: https://server.com/my-app.bundle.js
+ https://server.com/resources/codicon.ttf
When someone uses my library and includes it in own HTML page (<script src="https://server.com/my-app.bundle.js"></script>
) the library tries to access codicon.ttf
on local machine: http://localhost:8080/codicon.ttf
but actually it has to be loaded from remote server: https://server.com/resources/codicon.ttf
I'm trying to find some way how to solve this problem. I thought about:
- Set absolute path https://server.com/resources/codicon.ttf instead of relative using Webpack. I didn't find how it can be done.
- Place codicon.ttf into bundle my-app.bundle.js. Looks like it is possible (How to inline fonts in CSS with webpack?), however requires changing of 3rd party css (css in monaco-editor).
- Somehow override monaco-editor css and set absolute path there. Not sure about it.
Is any of my ideas correct? Perhaps this is a problem of monaco-editor and has to be fixed on their side?