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
Script file isn't loaded on start astro dev
when using tailwindcss
#4217
Comments
Interesting! So it sounds like there might be two bugs here. If anyone can track this down further, that would be great. @tony-sull is our resident TS expert but he's unfortunately out this week. |
I investigated this behavior, and I found some hints. As you say, there are two bugs. In common
When script file isn't loaded,
when script file is loaded correctly,
Problem1 (from 1.0.0-beta.73)Maybe this commit is relatedBugI need to reload the browser to load script on What I found
// doesn't work here (reload needed)
// const modInfo = viteServer.pluginContainer.getModuleInfo(rootID);
// addHoistedScripts(elements, modInfo, rootProjectFolder);
for await (const moduleNode of crawlGraph(viteServer, rootID, true)) {
// ...
}
// here, it works correctly without reload
const modInfo = viteServer.pluginContainer.getModuleInfo(rootID);
addHoistedScripts(elements, modInfo, rootProjectFolder); Problem2 (from 1.0.0-rc.4)Maybe this commit is relatedBugI need to save the script file to load it on What I found
However, this condition will skip only imported by style files.... I hope that this information helps to solve this issue. 🙏 |
I probably understand what happens. 👀 When not using tailwind (works correct)
When using tailwind (page not loading scripts)
SolutionBefore getting
I'll make a PR! |
Probably not useful for the contributors but maybe for someone who just wants to make a website using Astro now: inline scripts seem to not be affected. Replace your <script>
foo();
</script> with <script is:inline>
foo();
</script> and you're good to go (without TypeScript though, if that's your kink). Note to contributors: I only started to see this issue either after I added SCSS to my setup (did not see it with Tailwind alone) or after upgrading Astro from Update: what I still see happening occasionally is that my tailwind |
I'm having trouble reproducing this on the most recent version of Astro (1.5.6). Is anyone still running into this problem and have an up-to-date reproduction? |
Looks like there was an upstream issue in Vite that was fixed and has been out. vitejs/vite#9759 Will close this for now, but please re-open if you have a reproduction and we'll be happy to prioritize this! |
Actually, reopening this as platformatic/tutorial-movie-quotes-app#3 is pretty recent. Will take a look. |
@natemoo-re are you still planning on looking into this soon? If not I'd like to close it as being old / not ready to work on. |
I just checked back on the repro to confirm and this is definitely fixed in the latest! |
What version of
astro
are you using?1.0.0-rc.8
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows 10
Describe the Bug
Please see my sample repo.
That sample will show:
src\components\LoadingScreen\LoadingScreen.astro
src\pages\index.astro
Problem
astro dev
and access local pagesrc\scenes\main.ts
, canvas animation starts movingCase that Works
@use "node_modules/tailwindcss/utilities";
fromsrc/styles/style.scss
astro dev
and access local pageAdditional Notes
I tested some versions.
in 1.0.0-beta.69 ~ 72: working correctly (without removing
@use "node_modules/tailwindcss/utilities";
)from 1.0.0-beta.73: the problem occurs.
(Edited)
1.0.0-beta.73 ~ 1.0.0-rc.3:
astro dev
and access local page1.0.0-rc.4 ~:
astro dev
and access local pagesrc\scenes\main.ts
, canvas animation starts movingLink to Minimal Reproducible Example
https://github.com/kagankan/astro-sample/tree/41c58b10d639dbdecd9b020b331fa8ee94517ebc
Participation
The text was updated successfully, but these errors were encountered: