stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Add minimalcss.minimize() options #363

Closed j-evs closed 5 years ago

j-evs commented 5 years ago

Feature Request

Is your feature request related to a problem? Please describe. I'm using react-snap for prerendering root route in my CRA2 app. If inlineCss: true option is set, react-snap timeouts in docker container without any console error.

Describe the solution you'd like After some debugging, I've found that if minimalcss skips this code, build doesn't hang in docker container and everything is OK:

https://github.com/peterbe/minimalcss/blob/3cfacd75093d852f82763c75cc0dded0c04460c2/src/run.js#L286-L296

It'd be great for react-snap users to have the ability to override the default minimalcss options, that are used in inlineCss function:

https://github.com/stereobooster/react-snap/blob/b741d41e484dea1fd7160ef455b63ca5d401f747/index.js#L270-L276 It'd look something like this:

"reactSnap": {
  "minimalcss": {
     withoutjavascript: false
     // and other minimalcss options
   }
}

Describe alternatives you've considered I'm aware that this may not address the real issue that causes the build to hang in docker. I bet that it is caused by some weird Puppeteer behavior in docker container. I've also tried some combinations of react-snap options, like fixWebpackChunksIssue: "CRA2" etc, but that didn't help.

Teachability, Documentation, Adoption, Migration Strategy At a quick glance, that change shouldn't break anything and is straightforward to implement.

stereobooster commented 5 years ago

I don't see sense to add option just to hack around the actual problem. You are welcome to open a bug report and we can try to fix the bug.