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 behaviour when config loading failes #26

Closed
farwayer opened this issue Oct 12, 2016 · 7 comments · Fixed by #30
Closed

Fix behaviour when config loading failes #26

farwayer opened this issue Oct 12, 2016 · 7 comments · Fixed by #30

Comments

@farwayer
Copy link

I have no postcss configs. And several log messages at webpack log as result of using postcss-loader.

TypeError: Cannot read property 'config' of null
    at .../node_modules/postcss-load-config/index.js:44:22
@ai
Copy link
Member

ai commented Oct 12, 2016

@michael-ciniawsky +1

Maybe we need to add check is result a undefined before 44 line

@michael-ciniawsky
Copy link
Collaborator

+ result === undefined ? { config: {} } : result
- result = result.config || {}

should do the job

@ai
Copy link
Member

ai commented Oct 14, 2016

We could close it?

@michael-ciniawsky
Copy link
Collaborator

@ai yep :)

@kevinlaw91
Copy link

Hello. I still get this problem. I think this should be the correct fix instead... 😉

+ result = (result === undefined) ? { config: {} } : result
- result === undefined ? { config: {} } : result

@azrael
Copy link

azrael commented Oct 17, 2016

Yeah, you forgot to assign a value to a variable. And one more thing: cosmiconfig().load() returns null if config not found. So I assume you need to use !result instead of result === undefined.

@michael-ciniawsky michael-ciniawsky changed the title Errors in webpack log Fix behaviour when config loading failes Oct 17, 2016
@michael-ciniawsky
Copy link
Collaborator

@kevinlaw91 @Azrael25 👍 fix it asap

pcgilday added a commit to pcgilday/postcss-load-config that referenced this issue Oct 18, 2016
pcgilday added a commit to pcgilday/postcss-load-config that referenced this issue Oct 18, 2016
pcgilday added a commit to pcgilday/postcss-load-config that referenced this issue Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants