-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for vocab.config.cjs #176
Conversation
🦋 Changeset detectedLatest commit: 61880a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
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, but would appreciate a fixture or a unit test with a .cjs
config.
There's also undefined unspecified behaviour (to consumers) when both a vocab.config.js
and vocab.config.cjs
are present. We could do better, but I'm not against merging this PR as-is.
|
I meant it's undefined for consumers of Vocab. |
Context
Vocab currently supports vocab.config.js.
However, when using Vocab in ESM projects, Vocab may throw an error like this:
Vocab tries to do
require('./path/to/vocab.config.js')
, which shouldn't be possible inside an ESM workspace. vocab.config.js is assumed to be an ESM module, when it's actually a CJS module.Solution
This adds support for
vocab.config.cjs
.Caveats
Unfortunately, support for vocab.config.mjs won't be straight-forward.
A workaround is available as well:
vocab compile --config vocab.config.cjs