-
Notifications
You must be signed in to change notification settings - Fork 180
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
Hot reloading does not work for HTML templates #357
Comments
Having the same issue.. using: |
Any progress on this bug..? Or maybe a workaround.. ? |
Good day.. I have been playing around with it for a bit, and i noticed that it keeps working fine when there is no other css defined within this also only seems to happen when the styles are defined within that component or page, as when defining a scoped style in so a kind of bad workaround would be, to not define any styles within the style tags, and put everything inline.. i hope this gets fixed soon, as this kind of sucks.. kind regards. |
Good day again.. I have been playing around some more and have a little update, that when there is something commented out withing the style tags, as in if there is any form of type inside the style tags, hot reload stops working,... i have been looking into hot-update.js but i cant make heads or tails of it.. as it seems the updates are being pushed through. as the hot-update does show the modification,.. its just seems to not updating the DOM accordingly.. also removing tailwind from build modules does not solve the problem, only removing postcss with removal of node_modules and package-lock.json, will fix the problem. UPDATE!.. WORKAROUND! this fixed the problem for me.. cheers!!! |
downgrading as specified fixed issue for me also |
The workaround works but it downgrades Tailwind to v1.9.x which disables other handy features of Tailwind 2.x like arbitrary values. So it would be great if we could find a better solution which works with the latest included Tailwind version 2.x. An alternative workaround is to downgrade to v4.1: |
I've a template with nuxt app and tailwind 2.0 with JIT without bug, I didn't find the difference with new nuxt app, but this works: https://gitlab.com/ewilan-riviere/nuxt-tailwind-template |
some problem and 4.1.0 4.2.1 Compilation speed is 2x slow compared to 4.1.0 |
Downgrading to |
@HenrijsS Didn't seem to fix it for me. Tailwind 2.1.0 (through "resolutions" in package.json) and JIT turned on. Nuxt 2.15.7. |
What version of nuxt are you using..?
Also to the dev's.. what's up why this bug still existing... is there some
update on progress fixing this bug, next to downgrading .... are you only
planning to fix this in nuxt3 release ..?
Regards
…On Mon, 19 Jul 2021, 09:03 fabis94, ***@***.***> wrote:
@HenrijsS <https://github.com/HenrijsS> Didn't seem to fix it for me.
[image: image]
<https://user-images.githubusercontent.com/938316/126116947-60922aea-fe8a-42ec-82f9-142f57c7dbc4.png>
Tailwind 2.1.0 and JIT turned on.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3774YE4KQTOUCBAYPHPCLTYPE2LANCNFSM45VAOUSQ>
.
|
@cpt-n3mo I'm on nuxt 2.15.7 and latest version of @nuxt/tailwind, if you were asking me |
Sorry indeed I was talking to you 😅
Did you remove package lock and node module folder..? Then a fresh npm
install..? Regards..
…On Tue, 20 Jul 2021, 10:02 fabis94, ***@***.***> wrote:
@cpt-n3mo <https://github.com/cpt-n3mo> I'm on nuxt 2.15.7, if you were
asking me
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3774YJLNHWP5KDI7F2TT3TYUUSBANCNFSM45VAOUSQ>
.
|
@cpt-n3mo Yes, I did do that, didn't seem to make a difference. tailwindcss@2.1.0 |
@fabis94 |
@HenrijsS It's the default tailwind css: @tailwind base;
@tailwind components;
@tailwind utilities; Tailwind config: /* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
module.exports = {
mode: 'jit',
presets: [require('@fabis/custom-tailwind-theme').TailwindPreset],
purge: {
enabled: process.env.NODE_ENV === 'production',
content: [
'src/**/*.{vue,js,ts}',
'components/**/*.vue',
'layouts/**/*.vue',
'pages/**/*.vue',
'node_modules/**/*.vue',
],
},
}; Here's the plugin inside the custom tailwind theme: const plugin = require('tailwindcss/plugin');
/**
* This theme adds all of the custom styling that can't be done through the preset alone
*/
module.exports = plugin(function ({
addBase,
addComponents,
addUtilities,
theme,
}) {
const screens = theme('screens', {});
// BASE LAYER
addBase({
// Responsive font classes depending on locale
'.font-sans': {
'font-family': "'SomeFont', sans-serif",
},
"html[lang='ja'] .font-sans": {
'font-family': "'SomeFontJP', sans-serif",
},
});
// Base font applied on body
addBase({
body: {
'@apply font-sans': {},
},
});
// COMPONENTS LAYER
const headingCount = 5;
const headingDefinitions = {};
for (let i = 1; i <= headingCount; i++) {
headingDefinitions[`.heading-${i}`] = {
[`@apply text-h${i} font-bold`]: {},
};
}
addComponents(
{
// Heading classes
...headingDefinitions,
// Links
'.link-undecorated': {
'@apply text-blue-700 cursor-pointer': {},
},
'.link': {
'@apply link-undecorated hover:underline': {},
},
},
{ variants: ['responsive'] }
);
// UTILITIES LAYER
// Making font-size/line-height dynamic for some text utility classes
const smSize = screens['sm'];
addUtilities({
[`@media (min-width: ${smSize})`]: {
'.text-h1': {
'font-size': '48px',
'line-height': '60px',
},
'.text-h2': {
'font-size': '36px',
'line-height': '46px',
},
},
});
}); |
@fabis94 Did you try the good old disable-enable debugging? |
@HenrijsS Thanks for the effort, but that didn't help either. I removed the plugin, even turned off JIT, but the issue persists |
@fabis94 Expand the error and look for the stack trace and look which line is the Unaccepted module. |
@HenrijsS It's the same issue as before, it says that tailwind.css can't be reloaded: |
i see, remove the taiwindcss@2.1.0 and @nuxtjs/tailwindcss@4.2.1 and to dev deps "@nuxtjs/tailwindcss": "~3.4.3", "postcss": " remove package lock and node modules folder and do a npm install or yarn what ever you use.. it should work this way. regards. |
@cpt-n3mo Does this mean also downgrading PostCSS to 7.x? Cause I need Nuxt to use PostCSS 8 and Tailwind 2+ |
indeed that is the case .. its deff not ideal but it the only combination i found that works.. |
Here's an easy way to reproduce the issue:
Expected: To see the changes without page reload, using HMR. The issue appears to be related to how Tailwind JIT "caches" the previously used classes. Continuing from the previous steps:
The moment you add a class, whether built-in or arbitrary, which Tailwind (or the CSS loader?) has never seen before, it will cause HMR to break. Once the class has been cached somehow, HMR will work okay. |
Any news on this. is it being worked on ? |
Keeping this alive, any updates on this? |
I think all module development is on hold in preparation for Nuxt 3, so don't expect any updates. |
it's working, thanks! |
✅ ----- Temporary Solution ------ ✅ Hello everyone, apply this solution for now. -> Check example setup |
Is there any solution that does not involve downgrading to PostCSS v7? |
Thank you @productfrontenddeveloper but this is - again - a PostCSS 7 solution. Look at the package.json in the the example:
I cannot downgrade our application. |
There is no other solution at the moment, if you are not using anything related to postcss 8 nuxt/postcss8#18 you have to do this. |
A workaround that I've found to keep working with this module (and with any nuxt module that depends on @nuxt/postcss8), is to add this to your project package resolutions:
|
TL:DR, nuxt doesnt work when youre using tailwind. |
I managed to pinpoint the issue, for more details see: nuxt/postcss8#24 Temporary Fix You're likely experiencing this issue if you're:
Disabling // nuxt.config.js
export default {
/* ... */
build: {
loaders: {
css: {
modules: false,
},
},
}
} Cheers! |
commenting the |
I solved it by removing the |
Still facing the same problem using mentioned workarounds the be able to use TailwindCSS v3 |
TailwindCSS 3 might be a whole new issue of its own yeah ^^' |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any updated on this with latest v5 version and Tailwind 3? I still have this issue, HMR is not working if previously not used Tailwind class is added to template, it reloads whole page:
|
@vedmant, For now, I disabled the purging from Tailwind 3 in dev mode. |
- 컴파일시 eslint component이름의 복합명사 사용에러 끄기 - npm run dev 실행시 hot reload가 안되는 경우가 있음 정확한 원인은 모르겠으나 css와 관련이 있는것으로 추정 참조 : nuxt-modules/tailwindcss#357
i don't think it's practical for most people, the bundles are too heavy |
Hello, I encounter the issue and fixed this way. You can look and try to fix for your problem. https://en.ahmetonursolmaz.com.tr/nuxt-hot-reload-isnt-working/ |
Version
@nuxtjs/tailwindcss: 4.1.1
nuxt: 2.15.6
Reproduction Link
https://rechenknecht.net/lmm/nuxt-tailwind-bug-report
Steps to reproduce
yarn dev
pages/index.vue
(e.g. schaukasten -> schaukasten2)What is Expected?
What is actually happening?
Notes
Logo
component)The text was updated successfully, but these errors were encountered: