-
-
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
Load configs with Vite when loading with Proload fails #4112
Changes from 7 commits
60687f5
239a179
cc25585
211fbd8
dc8b51d
416a782
55d31aa
7028fca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/mdx': patch | ||
--- | ||
|
||
Fix MDX working with a ts config file |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { | |
// Workarounds tried: | ||
// - "import * as remarkShikiTwoslash" | ||
// - "import { default as remarkShikiTwoslash }" | ||
(remarkShikiTwoslash as any).default, | ||
(remarkShikiTwoslash as any).default ?? remarkShikiTwoslash, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good thinking here. Wonder if proload was somehow messing with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not why proload was failing. But this is needed to be compatible with loading in Vite. |
||
config.markdown.shikiConfig, | ||
]); | ||
rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import mdx from '@astrojs/mdx'; | ||
|
||
export default { | ||
integrations: [mdx()] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@test/mdx-page", | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"@astrojs/mdx": "workspace:*" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
does this mean that
--config
won't work with.ts
config files? Could this be moved to further down to be a final catchall, OR earlier in the function with afs.stat
call to check that the file exists before running proload or vite?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.
No, this condition hits when the user passes a
--config
but that file doesn't exist. If the file does exist and is a.ts
file it will either a) have worked through proload or b) caught here, but theinstanceof
check will fail and it will load through the subsequent Vite mechanism.