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

🐛 BUG: When using Deno or Node Adapter for SSR js and assets files are not resolved correctly #3117

Closed
1 task
muellercornelius opened this issue Apr 15, 2022 · 2 comments · Fixed by #3121

Comments

@muellercornelius
Copy link

What version of astro are you using?

1.0.0-beta.8

Are you using an SSR adapter? If so, which one?

Deno, Node

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

In dev mode everything is resolved fine, but when building for prod the files are getting splitted up in client and server.

The client bundle contains css and js files while the server folder only contains the entry.mjs file.

image

Now when generating the html it produces import paths like this: http://localhost:8085/assets/asset.de15421c.css. This path is correct when served from the right folder. But thats not the case. This way the browser cannot load styles or js files. Hopefully somebody is able to help me.

Steps to reproduce.

  1. Clone repo
  2. NPM install
  3. Start dev server and see how the styles of the button and the functionality works

Deno:

run npm build
run deno run index.js --allow-net and go to localhost:8085

Node

add "type": module", to package.json
run npm run build
uncomment node code in index.js
run node index.js and go to localhost:3000

Result

The button is not blue and when clicking on it, there is no alert.

Link to Minimal Reproducible Example

https://github.com/muellercornelius/Astro-SSR-asset-resolving-bug

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

matthewp commented Apr 15, 2022

The Node adapter isn't intended to be a fully web server. It's only meant to be used as middleware for you to use in your own web server where you handle things like static file serving yourself. With something like Express this is very easy.

Deno, I guess, should serve static files as well, given that you can deploy straight to Deno Deploy without any extra code of your own.

@muellercornelius
Copy link
Author

Ahhh thank you very much for pointing this out and adding it to the Deno Adapter. Of course I know how to add it to express but I thought it would be inside the scope of the Middleware.

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

Successfully merging a pull request may close this issue.

2 participants