hyrious / esbuild-repl

esbuild-wasm
https://hyrious.me/esbuild-repl
MIT License
77 stars 5 forks source link

feat: playground/codepen #8

Open hyrious opened 2 years ago

hyrious commented 2 years ago

Let's copy some ideas from https://sfc.vuejs.org (source: https://github.com/vuejs/repl).

whatnickcodes commented 2 years ago

This project is super cool - thanks for sharing. Would be awesome to see some sort of preview/render down the road!

hyrious commented 1 year ago

One good news is that evanw simulates a FS in the browser in https://esbuild.github.io/try/ via modifying the esbuild-wasm wrapper created by Go lang. Maybe I can learn this technique to make the codepen happen.

xiaosen7 commented 1 year ago

I'm currently designing an online demo sharing platform for my company, similar to CodeSandbox. Initially, I planned to use import maps to support npm package installation. My idea was to use esbuild-wasm on the frontend to bundle the developers' source code files and collect all the third-party module names. On the backend, I would parse the entry files of these third-party modules and bundle them into ESM modules, generating an import map to be returned to the frontend. However, I encountered some issues during the bundling process.

I tried using swc, esbuild, and rollup, and I even used your developed esbuild-plugin-commonjs package (which resulted in errors when bundling the company's component library). Unfortunately, the final results were not satisfactory. Some generated ESM bundles couldn't run in the browser. I've been stuck on this problem for several days now. Could you provide some assistance?

hyrious commented 1 year ago

@xiaosen7 Maybe you can provide some example codes or reproduction.

xiaosen7 commented 1 year ago

@xiaosen7 Maybe you can provide some example codes or reproduction.

Thank you for your reply,I've found a solution, by using esm.sh and adding some front-end hacks