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(astro): astro hmr warning and improve performance #2989

Merged
merged 1 commit into from Aug 16, 2023

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Aug 15, 2023

fix: #2987
fix: #2812

re-implement: #2593
We just align data-astro-dev-id with data-vite-dev-id

@Dunqing Dunqing requested a review from antfu as a code owner August 15, 2023 17:16
@netlify
Copy link

netlify bot commented Aug 15, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 57407e3
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/64dbb54d4985cd0008aa1913
😎 Deploy Preview https://deploy-preview-2989--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 configuration.

import { fileURLToPath } from 'node:url'
import type { AstroIntegration } from 'astro'
import type { VitePluginConfig } from '@unocss/vite'
import VitePlugin from '@unocss/vite'
import type { UserConfigDefaults } from '@unocss/core'
import type { Plugin, ResolvedConfig } from 'vite'
import { RESOLVED_ID_RE } from '../../shared-integration/src/layers'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhmm, shouldn't use shared package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhmm, shouldn't use shared package?

I'm not sure, the same usage is found in the vite plugin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to have this, they file will be inline and bundled with this package

Comment on lines +34 to +38
if (RESOLVED_ID_RE.test(id)) {
// https://github.com/withastro/astro/blob/087270c61fd5c91ddd37db5c8fd93a8a0ef41f94/packages/astro/src/core/util.ts#L91-L93
// Align data-astro-dev-id with data-vite-dev-id to fix https://github.com/unocss/unocss/issues/2513
return join(root, id)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this logic to vite plugin?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have it here, until if there is an actually issue on the Vite side

Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +34 to +38
if (RESOLVED_ID_RE.test(id)) {
// https://github.com/withastro/astro/blob/087270c61fd5c91ddd37db5c8fd93a8a0ef41f94/packages/astro/src/core/util.ts#L91-L93
// Align data-astro-dev-id with data-vite-dev-id to fix https://github.com/unocss/unocss/issues/2513
return join(root, id)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have it here, until if there is an actually issue on the Vite side

import { fileURLToPath } from 'node:url'
import type { AstroIntegration } from 'astro'
import type { VitePluginConfig } from '@unocss/vite'
import VitePlugin from '@unocss/vite'
import type { UserConfigDefaults } from '@unocss/core'
import type { Plugin, ResolvedConfig } from 'vite'
import { RESOLVED_ID_RE } from '../../shared-integration/src/layers'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to have this, they file will be inline and bundled with this package

@antfu antfu added this pull request to the merge queue Aug 16, 2023
Merged via the queue into unocss:main with commit 02f08bf Aug 16, 2023
10 checks passed
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.

HMR with Astro + Uno HMR weirdness with Astro + Uno
3 participants