Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy way to augment esbuild configuration #2399

Open
kitsonk opened this issue Apr 9, 2024 · 4 comments
Open

Easy way to augment esbuild configuration #2399

kitsonk opened this issue Apr 9, 2024 · 4 comments

Comments

@kitsonk
Copy link

kitsonk commented Apr 9, 2024

I am currently trying to integrate monaco-editor into an island from the esm source. The problem is that the source expects to have .ttf files loaded for it and currently esbuild integrated into fresh doesn't know what to do. The repo gives an example of how to configure esbuild to be able to be able to build from the esm source, but there seems to be no straightforward way of augmenting the esbuild configuration.

@marvinhagemeister
Copy link
Collaborator

marvinhagemeister commented Apr 9, 2024

Even if we'd expose the esbuild configuration it wouldn't work because we render islands on the server and we only use esbuild to generate the browser bundles. Deno will still error when it comes across an .ttf import statement. To make non-standard file imports work on the server we would need to transpile the server portion of Fresh too. So exposing esbuild alone in Fresh won't be enough.

I feel like longterm the most viable solution for us is to integrate with vite. I'm kinda waiting once they land their new environments API, because that will make it easy to generate server + browser bundles at the same time.

@kitsonk
Copy link
Author

kitsonk commented Apr 10, 2024

For my purposes, I forked fresh and made the modification. monaco-editor already had challenges being run server side and I had to already use an IS_BROWSER dynamic import when I was using esm.sh versus npm imports.

@nickguimond
Copy link

Another option might be to use AMD version of Monaco editor save reference to it on window and communicate with it from your island.

@nickguimond
Copy link

https://github.com/nickguimond/monaco_test
here is a rudimentary example, the commits are organized by the steps I took.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants