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

Support Vite.JS #568

Open
johannbuscail opened this issue Oct 31, 2022 · 4 comments
Open

Support Vite.JS #568

johannbuscail opened this issue Oct 31, 2022 · 4 comments

Comments

@johannbuscail
Copy link

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.

@eduhsoto
Copy link

eduhsoto commented Jan 10, 2023

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

@Lars418
Copy link

Lars418 commented Jan 18, 2023

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"
  },

@ssxjuan
Copy link

ssxjuan commented Jan 31, 2023

React-snap not working on Vite Typescript.-

@marcandrews
Copy link

marcandrews commented Feb 16, 2023

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 puppeteer/puppeteer@6c96011) 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants