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

Build fails when using <style>. #10909

Closed
1 task
seraku-matsuoka opened this issue Apr 30, 2024 · 4 comments
Closed
1 task

Build fails when using <style>. #10909

seraku-matsuoka opened this issue Apr 30, 2024 · 4 comments
Labels
needs response Issue needs response from OP

Comments

@seraku-matsuoka
Copy link

Astro Info

Astro                    v4.7.0
Node                     v20.10.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using <style> in an .astro file, I get the following error message when building.

Sometimes I can build without error, but the css is not loaded in the generated html file.

09:40:32 [ERROR] [vite] x Build failed in 1.05s
[astro:build] Could not load C:/Users/path/to/project/src/pages/index.astro?astro&type=style&index=0&lang.css (imported by src/pages/index.astro): No cached compile metadata found for "C:/Users/path/to/project/src/pages/index.astro?astro&type=style&index=0&lang.css". The main Astro module "C:/Users/path/to/project/src/pages/index.astro" should have compiled and filled the metadata first, before its virtual modules can be requested.
  Stack trace:
    at Object.load (file:///C:/Users/path/to/project/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/vite-plugin-astro/index.js:71:15)
    at file:///C:/Users/path/to/project/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19775:40
    at async file:///C:/Users/path/to/project/node_modules/.pnpm/[email protected]/node_modules/roll ELIFECYCLE  Command failed with exit code 1.

This happens even when I just created a project with default settings.

What's the expected result?

Could be due to Windows environment rather than Astro, but could not be identified.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-wnqguo?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 30, 2024
@matthewp
Copy link
Contributor

Is it because your <style> is below the html tag?

@matthewp matthewp added needs response Issue needs response from OP and removed needs triage Issue needs to be triaged labels Apr 30, 2024
@seraku-matsuoka
Copy link
Author

@matthewp
Thank you.
But just putting it in the html tag didn't solve the problem.

When I do a build, it generates an html file with no css loaded.

@BryceRussell
Copy link
Member

Do you have any more details that you can share about your environment? I tried reproducing this on Windows, but I am not getting any errors and I can see the styles in the output of the build.

@seraku-matsuoka
Copy link
Author

Sorry,
I tried it on another PC and it was not reproducible, so I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs response Issue needs response from OP
Projects
None yet
Development

No branches or pull requests

3 participants