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

Build is broken: r is not defined #783

Closed
lgordey opened this issue Jan 22, 2018 · 16 comments · Fixed by #797
Closed

Build is broken: r is not defined #783

lgordey opened this issue Jan 22, 2018 · 16 comments · Fixed by #797

Comments

@lgordey
Copy link
Contributor

lgordey commented Jan 22, 2018

Hi!
After updating to 6.2.0 most of components have an error:
image
Demo - https://github.com/lgordey/example

It reproduced only on build task - styleguide:build
In development mode everything seems fine

@lgordey
Copy link
Contributor Author

lgordey commented Jan 22, 2018

I guess that the thing, that unite all crashed components - is they all have readme example with some text inside.
Cause examples with Placeholder or RandomButton don't have such error.
image

@sapegin
Copy link
Member

sapegin commented Jan 22, 2018

Two funny facts:

  1. I don’t see it when I build the basic styleguide in the main repo.
  2. When I build your repo, I see slightly different error: ReferenceError: can't access lexical declaration r' before initialization`.

It feels like some new version of UglifyJS to me.

@sapegin
Copy link
Member

sapegin commented Jan 22, 2018

Looks like so, of course they don’t have a change log 🤦‍♂️

react-styleguidist@6.1.0 /Users/tema/_/react-styleguidist
└─┬ uglifyjs-webpack-plugin@1.1.4
  └── uglify-es@3.2.2

react-styleguidist-example@1.0.0 /Users/tema/example
└─┬ react-styleguidist@6.2.0
  └─┬ uglifyjs-webpack-plugin@1.1.4
    └── uglify-es@3.3.8

@lgordey
Copy link
Contributor Author

lgordey commented Jan 22, 2018

@sapegin yeap, if I completely remove new UglifyJSPlugin from make-webpack-config - everything is ok.

@lgordey
Copy link
Contributor Author

lgordey commented Jan 22, 2018

of course they don’t have a change log 🤦‍♂️

of course 😂

@lgordey
Copy link
Contributor Author

lgordey commented Jan 22, 2018

image

I think they are not completely sure about uglify-es version 😄

@sapegin sapegin changed the title r is not defined - after updating to 6.2.0 Build is broken: r is not defined Jan 23, 2018
@sapegin sapegin added the bug label Jan 23, 2018
@sapegin
Copy link
Member

sapegin commented Jan 23, 2018

As a temporary workaround I guess you can add an older version of uglify-es as a dependency of your project. I'm still not sure what would be the right fix for that and what exactly is broken.

@bstream
Copy link

bstream commented Jan 23, 2018

Ran in to the same error (I think, although for me it said ReferenceError: n is not defined. For me the error occurs with uglify-es@3.3.8 but not with uglify-es@3.3.7. If you are using using yarn@1.x you can use the resolutions field for this, like so:

"resolutions": {
  "uglify-es": "3.3.7"
}

Also; maybe this is related? mishoo/UglifyJS#2842

@lgordey
Copy link
Contributor Author

lgordey commented Jan 23, 2018

Updating to uglifyjs-webpack-plugin@1.1.5 inside react-styleguidist also should fix the problem, cause they freeze uglify-es version here https://github.com/webpack-contrib/uglifyjs-webpack-plugin/pull/199/files

@bluetidepro
Copy link
Collaborator

Yeah, I'm having this same problem with my builds, so a patch for this would be great.

@iamtyce
Copy link

iamtyce commented Jan 25, 2018

I can confirm that @bstream's approach worked perfectly for us. Hoping to remove that when Uglify push a fix.

@diegohaz
Copy link

@bstream's workaround fixed it for me.

@alanbsmith
Copy link
Contributor

oh, man. I'm so glad other people were seeing this too. I thought I was crazy. Can also confirm it's UglifyJS and @bstream 's workaround resolves it.

@nisargrthakkar
Copy link

nisargrthakkar commented Aug 31, 2018

I am using "react-styleguidist": "^7.3.2" and still facing the issue

capture

Here is my HowItWorks.md

React component example:
```js
<HowItWorks contain='Hello I am here boss' />```

@GuptaWeber
Copy link

I am using "react-styleguidist": "^9.2.0" and still I am facing this issue.

It's working when if we manually import all the required dependencies for the project in the Styleguidist example. But my Repository has many packages and many examples. It ends in a lot of code repetition.

Is there any way to solve this?
Help me guys..!

@hamedmam
Copy link

hamedmam commented Nov 9, 2019

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.

10 participants