`unbuild --stub` compatible with the browser
Describe the feature
Hi. Thanks for the awesome library. I like it and use unbuild stub mode in most of my projects. However, there is an issue that has forced me to remove it and use another tool instead temporarily.
When I was in the mono repo project, I had the Vite (client application) and some core packages. I had to fix the problem of jiti not working in the browser by configuring aliases in the Vite project. I see that we already have PR to solve this problem (#158). I believe that there are many users who encounter the same problem and it is very useful. Do we have any plans to release it soon? Thank you 🙏
@webfansplz Here's the issue I've encountered, which seems to be similar to yours: In a monorepo, when a Vite app references a package that has been built using unbuild --stub, I would expect the Vite app running in the browser environment to load the src/index.ts file directly rather than the compiled output from unbuild
I tried to migrate stub build to jiti/native, but vite would not transpile ts files which out of its dir. Maybe some more complex solutions are needed
Please consider using mkdist dir builder for libs meant to be fed into a bundler like vite for browser usage.
rollup stubs with jiti are meant to be used in Node.js runtime directly. We have introduced jiti/native but need some extra vite config to do alias, transpile, etc which makes it hard.
next gen of unbuild completely drops jiti for rollup stub since Node.js will also natively support typescript it will be same as mkdist builder.