Open hyrious opened 2 years ago
This project is super cool - thanks for sharing. Would be awesome to see some sort of preview/render down the road!
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.
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?
@xiaosen7 Maybe you can provide some example codes or reproduction.
@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
Let's copy some ideas from https://sfc.vuejs.org (source: https://github.com/vuejs/repl).