Skip to content

Conversation

@jasonlyu123
Copy link
Member

#1115

throw an error when the default export is not found and showing the failed config file path


if (!config) {
throw new Error(
'Missing exports in the config. Make sure to include "export default config" or "module.exports = config"'
Copy link
Member Author

@jasonlyu123 jasonlyu123 Jul 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benmccann It's this error message ok to you? It's modified from the one in svelte kit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks good and would help make it clearer what the issue is. Thanks!

Even more than that I'd really like --ignore to avoid trying to load the config in the first place, but this is still helpful

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the problems I can think of it's that the ignored file could still be imported by another file. And when the svelte-preprocess default language config is set in that errored config file. The ignored file might be recognized as the wrong script type(js or ts). Thus creating some confusing typing errors in like props type check. I'll have to think about how to suppress the error message more.

@jasonlyu123 jasonlyu123 merged commit b421e1a into sveltejs:master Jul 28, 2021
@jasonlyu123 jasonlyu123 deleted the config-err-message branch July 28, 2021 14:36
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