-
-
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: add support for js/mjs
file extensions for Content Collections config file
#6229
Conversation
🦋 Changeset detectedLatest commit: 08d0902 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 |
js/mjs
file extension for Content Collections config filejs/mjs
file extensions for Content Collections config file
@@ -0,0 +1,5 @@ | |||
--- | |||
'astro': patch |
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.
Patch because this is already documented
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 code looks great! However, there's a caveat to using mjs
configs: intellisense will not work unless "allowJs: true
is present in your tsconfig.json
, or if you switch to a jsconfig.json
.
I'm curious if we can check for allowJs
in your tsconfig
, and log a warning if it isn't present. This would guide users in the right direction to avoid future support tickets. A callout in our docs would be great too!
Ah thanks for the heads-up! I just found this commit on discord withastro/docs@bb99ae0 where |
@MoustaphaDev Ah good catch. I've been unable to replicate that issue outside of docs but it's probably worth more testing. I verified |
I don't see anything breaking @bholmesdev! Working on implementing the warnings |
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.
Super small nit but looks amazing! Feeling config
dent 👏
Co-authored-by: Ben Holmes <hey@bholmes.dev>
Thanks for the work on this, @MoustaphaDev! |
Changes
Closes #6179
Testing
Check that an error is thrown when the frontmatter doesn't match the schema of the collection defined in the
config.mjs
file.I could add a test case for a
config.js
but it seems redundant as the config file has to be a module anyway.Docs
Bug fix, we already document this