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

fix: don't error for missing baseConfig, when makeServer is provided #2213

Closed
wants to merge 1 commit into from
Closed

fix: don't error for missing baseConfig, when makeServer is provided #2213

wants to merge 1 commit into from

Conversation

timiyay
Copy link

@timiyay timiyay commented Jul 21, 2021

This PR attempts a fix for #2212.

The bug arises when an app defines an export function makeServer(), but doesn't also define an export default function ().

According to the Mirage docs, this use case is supported. In practice, it is not.

Typically, the /mirage/config.js file contains a single default export which is a function... You can now opt in to ... exporting a single named function called makeServer instead.

https://github.com/miragejs/ember-cli-mirage/blob/f0ce745cfbe8f10a0b7ae7b2c32aa1c46e0e63e0/tests/dummy/app/pods/docs/advanced/server-configuration/template.md

The change in this PR was made naively, editing the specific conditional causing the error to be thrown, without a full understanding of code being changed. Nonetheless, this fixed my own issues and the Mirage development server ran without issue.

@cah-brian-gantzler
Copy link
Collaborator

I have created a PR #2215 that in addition to addressing this concern, will also allow what was the makeServer function to actually be a default exported function. This should help with the embroider issues.

If you agree, I would close this PR in favor of that one.

Sorry for the churn, if I only knew then when I know now :)

@timiyay
Copy link
Author

timiyay commented Aug 2, 2021

Thanks so much! ❤️

@timiyay timiyay closed this Aug 2, 2021
@timiyay timiyay deleted the timiyay/fix-default-export branch August 2, 2021 01:00
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