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

Compilation Failure when Making a Production Build with create-react-app v2 #5712

Closed
npkhoa2197 opened this issue Nov 5, 2018 · 8 comments
Closed

Comments

@npkhoa2197
Copy link

npkhoa2197 commented Nov 5, 2018

Is this a bug report?

NO

NOTE: I does not encounter this issue in create-react-app v1

I encounter this compilation failure when doing a production build after migrating from create-react-app v1 to create-react-app v2. The local development, i.e: yarn start, is still working properly.

I tried to fix this by using SCSS interpolation, i.e: wrap $progress-size and $border-size with #{} --> #{$progress-size} #{$border-size} and it solves the problems.

image

I wonder why I have to fix like that? Thanks in advances.

@dreamyguy
Copy link

Similar problem here, get this error when I hit the first $variableDefinition while attempting to compile. If I comment this out it will stop at the second variable definition. 😢

@dreamyguy
Copy link

False alarm on my part. By elimination, I found that the culprit was a SASS function. It turned out I was using a rem-calc function that lives on another file (_functions.scss), without doing the import.

Doing the import did the trick and got rid of the error. ✨

@import "functions";

@stale
Copy link

stale bot commented Dec 8, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Dec 8, 2018
@stale
Copy link

stale bot commented Dec 13, 2018

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Dec 13, 2018
@Mulli
Copy link

Mulli commented Dec 16, 2018

While issue closed 3 days ago...
I have the same problem

Creating an optimized production build...
Failed to compile.

Lexical error on line 1: Unrecognized text.
  Erroneous area:
1: 100% - $sidebar-width
^.........^
error Command failed with exit code 1.

Using:
"react-scripts": "^2.1.1",
Any idea how to solve it?
Thanks!!!

@pieplu
Copy link

pieplu commented Dec 18, 2018

@Mulli Same issue for me.

Your 100% - $sidebar-width is in a CSS calc() ?

I fix it by wraping variable with sass interpolation #{}.

Try this insted: 100% - #{$sidebar-width}

@Mulli
Copy link

Mulli commented Dec 18, 2018

Yes. I did the same following the answer of @npkhoa2197.
Thanks!!!

@pieplu
Copy link

pieplu commented Dec 18, 2018

My bad.... I did not read all the message.... Thanks!

@lock lock bot locked and limited conversation to collaborators Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants