Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This PR adds support for using
snowpack.config.cjs
in addition to all of the existing config formats. This was a blocker for me when trying to use snowpack in a project that had"type": "module"
specified.Turns out all that was required was upgrading
cosmiconfig
to v7 and 1 line of code change.One important consideration is that cosmiconfig v7 drops support for node 8, now requiring node 10+: https://github.com/davidtheclark/cosmiconfig/blob/master/CHANGELOG.md#700. Looks like snowpack already requires node version
>=10.19.0
inengines
, so I imagine this might not need to be considered a breaking change, but calling it out just in case we might want to save this for a major version for whatever reason.I've also updated the appropriate section in the docs to include the new format. Let me know if there's any other changes you'd like to see.
Testing
I tested this manually by building locally and copy pasting the build to the project with
snowpack.config.cjs
config, and then manually bumping the version of cosmiconfig in that project. Seems to be working great.Since this functionality is almost entirely handled by cosmiconfig, I didn't feel a new test here would add much value, but happy to add one if folks disagree.