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

feat(vite, webpack): add extraContent option #1963

Merged
merged 4 commits into from Dec 21, 2022
Merged

feat(vite, webpack): add extraContent option #1963

merged 4 commits into from Dec 21, 2022

Conversation

sibbng
Copy link
Member

@sibbng sibbng commented Dec 5, 2022

Closes #1944
Fixes #1937 // astro islands
Fixes #1734 // astro islands
Fixes #1947 // nuxt content
Fixes #2005 // nuxt content

Note
At the moment nuxt module is not pre-configured. I will add it soon.

I wanted to emphasize the external word by naming it watchExternal. Otherwise calling it something more generic might confuse people who migrate from other tools.

We're applying transformer plugins to files captured by this filter. But not really transforming them. Since those files are not processed by Vite, it's better to not transform them at all. I far as I see, our CLI package directly modify source files which is something really unintuitive.

In the case of Astro, files captured by this filter will go through transformer plugins. Because client-only components in Astro will be processed by Vite during client build. Since we already applied transformers on the SSR side manually, the required classes are already generated in bundled CSS.

@sibbng sibbng requested a review from antfu as a code owner December 5, 2022 00:53
@netlify
Copy link

netlify bot commented Dec 5, 2022

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit c96bbb6
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63a073e1b50b2b000877adcd
😎 Deploy Preview https://deploy-preview-1963--unocss.netlify.app/play
📱 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.

@antfu antfu changed the title feat(vite): add watchExternal option feat(vite): add extraContent option Dec 19, 2022
@antfu antfu changed the title feat(vite): add extraContent option feat(vite, webpack): add extraContent option Dec 19, 2022
@antfu
Copy link
Member

antfu commented Dec 19, 2022

I renamed the options to be extraContent to be more general and allow different sources in the future. I also moved the logic into shared-integrations to have the option to also work in Webpack build.

It seems to work, /cc @sibbng if you can help verify I didn't accidentally break anything.

@antfu antfu merged commit b7a6687 into main Dec 21, 2022
@antfu antfu deleted the feat/watchexternal branch December 21, 2022 11:15
praburangki pushed a commit to praburangki/unocss that referenced this pull request Jan 12, 2023
* feat(vite): add `watchExternal` option

* chore: lint

* refactor: api

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants