You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opaque error for invalid CSS after upgrade: TypeError: Cannot read property '0' of undefined #6282
After upgrading from react-scripts 1.1.4 to 2.1.3 see an opaque error message when trying to build:
Error in TypeError: Cannot read property '0' of undefined
Thought this might be related to #2069 (determined to be bug of package managers?), but after trial and error determined it was related to invalid CSS.
Reproduce (react-scripts 2.1.3):
Add invalid CSS to any .css file, like:
label[for=*] {
margin-right: 12px;
}
yarn build
Output:
Error in TypeError: Cannot read property '0' of undefined
This invalid CSS does not produce a build error in react-scripts 1.1.4, so this is something people will bump into when they upgrade and not really know what to do (e.g., claim the upgraded version is broken).
OK, so it looks like this need to be properly investigated ad solved. Would you be able to raise a PR? If not, we can leave it open for someone to pick up (perhaps me on the weekend).
Activity
mrmckeb commentedon Jan 30, 2019
Interesting, that is a mysterious error message @buildbreakdo. Thanks for tracking down the cause.
Was it telling you that a JS or CSS file had an error? Can you supply an example in a repo? Thanks!
buildbreakdo commentedon Feb 4, 2019
@mrmckeb Yes, indeed it is! This is what the full output looks like:
Here is an example repo:
https://github.com/buildbreakdo/css-breaks-create-react-app-demo
Clone and
yarn buildto see the error message. Line that causes this is here (invalid CSS):https://github.com/buildbreakdo/css-breaks-create-react-app-demo/blob/master/src/App.css
mrmckeb commentedon Feb 5, 2019
OK, so it looks like this need to be properly investigated ad solved. Would you be able to raise a PR? If not, we can leave it open for someone to pick up (perhaps me on the weekend).
Thanks for the repo too, that's great help.
buildbreakdo commentedon Feb 5, 2019
@mrmckeb Yes, I'll give it a go, see if I can get a PR in sometime this week.
buildbreakdo commentedon Feb 6, 2019
@mrmckeb Pull request with a fix is in
Add additional information for postcss errors (#6282) (#6352)