Skip to content
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

normalize svelte.config.js format #1303

Merged
merged 1 commit into from
Oct 14, 2020

Conversation

Rich-Harris
Copy link
Contributor

Changes

Currently, @snowpack/plugin-svelte will read configuration from a svelte.config.js file assuming the following structure:

module.exports = {
  preprocess: {...},
  ...compilerOptions
};

Unfortunately, this makes it impossible to add any config other than compiler options. For example, in the Snowpack/Svelte integration we're working on, it's necessary to specify an adapter to process the build output, and if we can't do so in svelte.config.js then we would have to introduce a new config file.

This PR changes the plugin behaviour to be in line with the format articulated here, which we're encouraging all members of the ecosystem to adopt:

module.exports = {
  preprocess: {...},
  compilerOptions: {...}
};

Unfortunately, I don't think there's a way to do this as a non-breaking change. (It should affect very few people, since most people only use svelte.config.js to specify preprocess, the behaviour of which is unchanged.)

Testing

Tested with a local project. There aren't any automated tests that currently cover this aspect of the plugin's behaviour.

Docs

The current expected svelte.config.js structure isn't documented anywhere, so this PR doesn't change anything.

@Rich-Harris Rich-Harris requested a review from a team as a code owner October 14, 2020 02:47
@vercel
Copy link

vercel bot commented Oct 14, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/mk384x7ll
✅ Preview: https://snowpack-git-normalize-svelte-config.pikapkg.vercel.app

@FredKSchott
Copy link
Owner

Makes sense, and I'd rather make this change sooner than later.

Unfortunately this is currently documented in the plugin README and I know of a couple of projects that use it (including some of our own!). I'll go ahead and merge this and then spin up a follow-up PR to create warnings if you use the legacy format to help people transition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants