unjs / unbuild

📦 A unified JavaScript build system
MIT License
2.3k stars 89 forks source link

Not respecting the config #45

Closed eric-burel closed 1 year ago

eric-burel commented 2 years ago

Hi,

I am trying to benchmark various tools on this open source repo: https://github.com/VulcanJS/npm-the-right-way

My goal is to bundle full-stack packages, with client-only, server-only and shared code. It means having 3 or 4 builds per package: client-only code with ESM, server-only code in CJS, and shared code with ESM (and potentially CJS when running in Node).

I couldn't make Unbuild work though, despite using a quite simplistic config. I have taken inspiration from Blitz toolkit build, but with no success (my setup is slightly trickier): https://github.com/blitz-js/blitz/pull/3129/files#diff-acbd8ab446622ef1fa925f81b1df9e4a69f1bfe75dcf209bfd778ad235b3cfc8

You can repro like this:

git clone https://github.com/VulcanJS/npm-the-right-way
cd npm-the-right-way/my-package-unbuild
yarn
yarn run build

The dist folder only contains one index file and empty folder, it's kinda weird and I fail to fix the build.

pi0 commented 1 year ago

Hi dear @eric-burel sorry for responding late.

Next release comes with multi-configuration support #275 also fixed in https://github.com/unjs/unbuild/commit/11c47c8d259a90bba6a74e837f312914447d50a5 possibly resolves the issue of dist dir being cleaned up.

If you still had issues, please ping me to reopen and would be happy to investigate your project.