stereobooster / react-snap

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

Doesn't work without index.html #349

Open n3g2 opened 5 years ago

n3g2 commented 5 years ago

Bug Report

Current Behavior "reactSnap": { "source": "dist/template/cash", "include": [ "/cashTasks.html" ], "crawl": false, "minifyHtml": { "collapseWhitespace": false, "removeComments": false } } Error: ENOENT: no such file or directory, open 'path to/dist/template/cash/index.html'

Expected behavior/code I expect to read: /dist/template/cash/cashTasks.html

https://github.com/stereobooster/react-snap/issues/347

stereobooster commented 5 years ago

There is no reproducible demo.

n3g2 commented 5 years ago

I think it's caused here. https://github.com/stereobooster/react-snap/blob/master/index.js#L628-L630

stereobooster commented 5 years ago

index.html copied to 200.html and 200.html used as indicator if react-snap already was executed over this code. To change this behaviour we would need to introduce alternative ways to check it, for example .react-snap-was-here. Also we will need to throw errors on 404 in crawler, if there is no fallback page (no 200.html).

n3g2 commented 5 years ago

I already have a fallback page create by myself, so I don't need fallback pages create by react-snap. Next, there is no need for a crawl marker. Each crawl can be recorded in memory. If you must create indicator, you can generate map files. like project root/.react-snap/craw.json.

stereobooster commented 5 years ago

Indicator required to prevent double run of react-snap over the same source, which can cause unexpected issues, so it should be placed together with target folder.