-
Notifications
You must be signed in to change notification settings - Fork 508
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
chore(server): clean-up #11968
chore(server): clean-up #11968
Conversation
Bundle StatsHey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
@@ -250,7 +250,7 @@ app.get("/*", async (req, res) => { | |||
console.log(`Don't know how to mock: ${req.path}`, req.query); | |||
res | |||
.status(404) | |||
.sendFile(path.join(STATIC_ROOT, "en-us", "_spas", "404.html")); | |||
.sendFile(path.join(BUILD_OUT_ROOT, "en-us", "_spas", "404.html")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was wrong all along. The SPAs end up in BUILD_OUT_ROOT which happens to have the same default as STATIC_ROOT...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments aside from the undefined res
es (which I'm sure came from a late-stage refactor), and other linting errors:
server/index.ts
Outdated
} | ||
res.header("Content-Security-Policy", CSP_VALUE); | ||
return res.send(renderHTML(doc)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think doc
has a url
key, does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the old world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just one typing comment:
server/index.ts
Outdated
toc: __, | ||
sidebarHTML: ___, | ||
...builtMetadata | ||
} = (doc.doc as any) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to not, do we need the || {}
? doc.doc
should be defined according to the types, and if it's not, we might as well blow everything up:
} = (doc.doc as any) || {}; | |
} = (doc.doc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 fixed
Summary
Refactor routes for the dev-server.
Problem
The routes are rather messy.
Solution
Start grouping things better.
This PR:
into a separate route.
How did you test this change?
yarn dev