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

fix(vite): respect rollupoptions specified output dir in lib mode (#2231) #2231

Merged
merged 4 commits into from Feb 22, 2023
Merged

fix(vite): respect rollupoptions specified output dir in lib mode (#2231) #2231

merged 4 commits into from Feb 22, 2023

Conversation

agufagit
Copy link
Contributor

closes #2192

@agufagit agufagit requested a review from antfu as a code owner February 21, 2023 16:25
@netlify
Copy link

netlify bot commented Feb 21, 2023

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 16f7720
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63f5e749dbcf7200088e23d5
😎 Deploy Preview https://deploy-preview-2231--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@agufagit
Copy link
Contributor Author

@antfu fixture test is done. I created a new pr to merge with vue-cli4 bug fix because it's easier than to rebase the commits.

note that when you call vite's build command from code, rollupOptions.output[].dir has to be absolute path, it's no problem if calling vite build from console.

This case might be rare. I was writing a UI components library https://ui.agufa.tech/ for Vue and Svelte based on Unocss last July. There was a treeshaking problem with either Nuxt or Sveltekit (I don't remember which one exactly) with a single .js file, so I had to use rollupOptions per-module to generate js files.

That said, I still want this to work because I'm going to do a new project in Qwik, and I'm transforming this UI library to qwik syntax. As qwik is relatively new, I want to keep using what was safely working because you never know when a new framework might blow up.

@antfu antfu added this to the Next milestone Feb 22, 2023
@antfu antfu changed the title fix(vite): respect rollupoptions specified output dir in lib mode fix(vite): respect rollupoptions specified output dir in lib mode (#2231)Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com> Feb 22, 2023
@antfu antfu merged commit f15071c into unocss:main Feb 22, 2023
@antfu antfu changed the title fix(vite): respect rollupoptions specified output dir in lib mode (#2231)Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com> fix(vite): respect rollupoptions specified output dir in lib mode (#2231) Feb 22, 2023
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

Successfully merging this pull request may close these issues.

doesn't generate css files because it doesn't respect rollupOptions when vite builds in library mode
2 participants