-
Notifications
You must be signed in to change notification settings - Fork 192
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
HMR doesn't work with .css?inline (inline css imports) #600
Comments
I found a workaround in the meantime: #609 (comment) |
@A-Shleifman - have you found a workaround for react? |
Apart from fixing this problem in crxjs, there are 3 options that I can think of:
npx chokidar-cli 'src' -c 'touch tailwind.css' but I haven't tested it
|
I'm not sure this issue is specific to Tailwind. Before loading the extension, it detects changes. However, once I load the extension, changes are no longer detected only to those
Is it possible that it can't find it due to the script having an extra Moving from the current stable version (1.0.14) to beta (2.0.0-beta.18) seems to fix the issue for vite2.9.15. I believe the wrong handling's origin is here: chrome-extension-tools/packages/vite-plugin/src/node/plugin-contentScripts_dynamic.ts Line 76 in 5bf6711
|
@jacksteamdev Can we get this fixed ? Looks like a PR for this issue is available. |
For anyone seeking robust HMR support with inline CSS, I recommend checking out chrome-ext-starter. This project not only offers excellent HMR support but also integrates Tailwind CSS and Daisy UI seamlessly into the shadow DOM. It's a great choice for projects requiring efficient handling of inline CSS updates. also you can visit here for quick overview |
Found workaround 🫡
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
// fix here
safelist: [
{
pattern: /^.*$/, // 👈 This includes all Tailwind classes in the bundle
},
],
}; Only for development mode: /** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
safelist: [
process.env.NODE_ENV !== 'production' && {
pattern: /^.*$/, // 👈 This includes all Tailwind classes in the bundle only for development mode
},
],
}; P.S. I spent the whole day trying to fix this, but came up with an idea in the shower the next day 😁 |
Build tool
Vite
Where do you see the problem?
Describe the bug
I'm importing tailwind css to inject it into a shadow DOM. I don't want it to be available anywhere else, so I have to import it as
tailwind.css?inline
rather thantailwind.css
.When changing CSS classes in components, HMR is triggered properly if styles are imported with
tailwind.css
, but not withtailwind.css?inline
. Both are supported by Vite without crxjsExample code
Reproduction
Example provided above
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: