React-styleguidist: Build is broken: r is not defined

Created on 22 Jan 2018  Β·  16Comments  Β·  Source: styleguidist/react-styleguidist

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

bug help wanted

Most helpful comment

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' />```

All 16 comments

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

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 declarationr' before initialization`.

It feels like some new version of UglifyJS to me.

Looks like so, of course they don’t have a change log πŸ€¦β€β™‚οΈ

[email protected] /Users/tema/_/react-styleguidist
└─┬ [email protected]
  └── [email protected]

[email protected] /Users/tema/example
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

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

of course they don’t have a change log :man_facepalming:

of course πŸ˜‚

image

I think they are not completely sure about uglify-es version πŸ˜„

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.

Ran in to the same error (I think, although for me it said ReferenceError: n is not defined. For me the error occurs with [email protected] but not with [email protected]. If you are using using [email protected] you can use the resolutions field for this, like so:

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

Also; maybe this is related? https://github.com/mishoo/UglifyJS2/issues/2842

Updating to [email protected] 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

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

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

@bstream's workaround fixed it for me.

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.

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' />```

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..!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lyz810 picture lyz810  Β·  3Comments

davidjb picture davidjb  Β·  3Comments

crobinson42 picture crobinson42  Β·  3Comments

gargroh picture gargroh  Β·  3Comments

dzimmerman902 picture dzimmerman902  Β·  3Comments