-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix memleak caused by directory names containing '.md' or '.mdx' #5264
Conversation
🦋 Changeset detectedLatest commit: 9fe2887 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
mind adding a test fixture for this? |
@@ -193,7 +193,7 @@ export default function jsx({ settings, logging }: AstroPluginJSXOptions): Plugi | |||
|
|||
const { mode } = viteConfig; | |||
// Shortcut: only use Astro renderer for MD and MDX files | |||
if (id.includes('.mdx') || isMarkdownFile(id, { criteria: 'includes' })) { | |||
if (id.includes('.mdx') || isMarkdownFile(id, { criteria: 'endsWith' })) { |
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.
If this causes memory leaks for markdown files, maybe it does happen for folders with .mdx
too? Would you check that please?
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.
Oh good point. Gonna fix.
Will do |
Added test/fixture for this and also fixed what @MoustaphaDev pointed out. |
Thanks! |
Changes
I must mention, I'm very excited to contribute in some way to this awesome project.
Now, the matter at hand:
This fixes a bug caused by wrongly treating files as markdown. If the project's path contains '.md' (or any markdown extension) serving any page containing javascript results in the server crashing due to the heap running out of memory.
I noticed this behaviour when developing my personal website, 'vladinski.md' :)
Testing
Ran entire test suite.
Writing a test seemed overkill, considering such a peculiar type of bug.
If a test is required, please tell me so and I'll find a way to implement it.
Docs
No docs added since this is a fix that doesn't modify a user's usage.