stereobooster / react-snap

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

React-snap with Laravel mix? #508

Open djlimix opened 3 years ago

djlimix commented 3 years ago

Is it possible to use react-snap with React and Laravel Mix? Because my scripts in package.json look like this:

"scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },

There is no command like npm run build, so what should I do?

Hamzi4546 commented 1 year ago

Have you figured it out because I am using react.js integrated in laravel and when I make a postbuild using react snap it is showing me errors that the pages are not found.

What I have is I have app.blade.php in my resources/views which serves as public/index.html and app.jsx in my resources/js which serves as src/index.js.

When i try to make a postbuild it is showing me errors of missing files in the specifies locations.

Missing index.html in public, missing index.js in src.

Please let me know how can I fix this issue if you have any idea about it.