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

SSR pages are not getting their resources (<link> / <style> / <script> tags) bundled and optimized with the serve command #1098

Closed
thescientist13 opened this issue Apr 15, 2023 · 0 comments · Fixed by #1100
Assignees
Labels
bug Something isn't working CLI P0 Critical issue that should get addressed ASAP SSR v0.28.2
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Apr 15, 2023

Type of Change

Bug

Summary

After upgrading to v0.28.0, noticed that when introduced API routes into a "static" project, this combination triggers the hybrid server, but the HTML coming back is showing a bunch of 404s because none of the assets were loading correctly in the browser.

Screen Shot 2023-04-15 at 2 25 03 PM

<link rel="stylesheet" href="../styles/main.css" data-gwd-opt="inline">
          
<script type="module" data-gwd-opt="static" src="../components/footer/footer.js"></script>
<script type="module" data-gwd-opt="static" src="../components/header/header.js"></script>
<script type="module" src="../components/nav/nav.js"></script>
<script type="module" src="../components/video-card/video-card.js"></script>

The reason for this is it looks like all the paths (from a template) were pointing to the development paths and so of course everything is broken as a result.

As a note, seems like these shouldn't be returning a 500 though, should be a 404.

Details

The issue after some debugging appears to be that when an SSR page goes into its optimization phase, none of the imports are there because graph.json is written before all the files are bundled. The simple solution is to just re-serialize graph.json during the bundling phase to get that latest state.

My concern is that these imports are built up from modelResource, which will also have a ton of raw contents, which would significantly bloat graph.json, so should keep that in mind.

Should also make sure this can be tested.

@thescientist13 thescientist13 added bug Something isn't working CLI SSR v0.28.1 labels Apr 15, 2023
@thescientist13 thescientist13 added this to the 1.0 milestone Apr 15, 2023
@thescientist13 thescientist13 self-assigned this Apr 15, 2023
@thescientist13 thescientist13 changed the title SSR pages are not getting their resources (<link> and <script> tags) bundled and optimized with the serve command SSR pages are not getting their resources (<link> / <style> / <script> tags) bundled and optimized with the serve command Apr 15, 2023
@thescientist13 thescientist13 added v0.28.2 P0 Critical issue that should get addressed ASAP and removed v0.28.1 labels Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI P0 Critical issue that should get addressed ASAP SSR v0.28.2
Projects
Development

Successfully merging a pull request may close this issue.

1 participant