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
Conversation
✅ Deploy Preview for unocss ready!Built without sensitive environment variables
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' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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) | ||
} |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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
fix: #2987
fix: #2812
re-implement: #2593
We just align
data-astro-dev-id
withdata-vite-dev-id