react-snap icon indicating copy to clipboard operation
react-snap copied to clipboard

Support Vite.JS

Open johannbuscail opened this issue 3 years ago • 4 comments

Feature Request

Is your feature request related to a problem? Please describe. Cannot use the react-snap with vite.js

Describe the solution you'd like Would be great to have an implementation of react-snap for the react plugin of vite.js

Describe alternatives you've considered I've considered using vite-plugin-ssr prerendering option, but my project is small and using this library requires a lot of changes, refactoring and useless boilerplate. I'd like to have a simple solution for vite and I think react-snap is a perfect fit.

johannbuscail avatar Oct 31 '22 10:10 johannbuscail

How resolve your problem? Did you use other library for prerendering?

eduhsoto avatar Jan 10 '23 23:01 eduhsoto

I haven't had any problems using react-snap in combination with vite.js. You just need to add "postbuild": "react-snap" to your scripts object and change the source folder to dist inside your package.json:

  "reactSnap": {
    "source": "dist"
  },

Lars418 avatar Jan 18 '23 21:01 Lars418

React-snap not working on Vite Typescript.-

ssxjuan avatar Jan 31 '23 19:01 ssxjuan

react-snap works with Vite; it's just that the included version of Puppeteer uses Chromium 78 for which your app after building may be incompatible due to unsupported ECMAScript features.

This line is incompatible with puppeteer@>=14 (since https://github.com/puppeteer/puppeteer/commit/6c960115a3230e247de628b85dea7c1c02582d6d) so you can try using yarn resolutions or similar to force the installation of puppeteer@^13

  // package.json
  "resolutions": {
    "puppeteer": "^13"
  },

This will include Chromium 101 that should improve compatibility.

marcandrews avatar Feb 16 '23 14:02 marcandrews