Comments (8)
I don't mind it, but to be honest, a bit of config isn't maybe too bad:
/* package.json */
{
...,
"react-snapshot": [
"/",
"/form?with=params"
]
}
That way at least each line is nicely tracked by version control...
from react-snapshot.
Yeah I think that's common enough. I'm thinking that "zero configuration" should maybe mean "no configuration beyond command-line args". So you could do
react-snapshot / /form?with=params
Alternatively, we could look for something in package.json
but... that feels unnecessary
from react-snapshot.
For this type of configuration, are command line args a bit "ugly" in that usually react-snapshot
is called inside a package.json script?
"build": "react-scripts build && react-snapshot / /form?with=params"
Which looks like your pushing knowledge of your routes upstream (i.e. out of src
up into package.json).
Maybe there's smarter ways / tricks to avoid putting it straight in package.json - e.g. make a local bin/react-snapshot
:
#!/bin/bash
react-snapshot / /form?with=params
And then the package.json script becomes:
"build": "react-scripts build && bin/react-snapshot"
Would you solve it like that, or does it not really bother you putting the cmd line args in package.json?
from react-snapshot.
Yeah that would be nicer, especially with, say, 10 paths.
Not that this affects me, but being hard-coded in package.json means that you can't have extra paths that are unknown at compile time (e.g. extra paths created from an array of products).
Not sure if that's something to consider.
from react-snapshot.
Yeah but those should be found by crawling your product index file, right?
from react-snapshot.
Yep it was a contrived example of a set of paths that might need to be generated at runtime based on other data - I don't actually have that case.
from react-snapshot.
Maybe a more realistic example would be if you had paths like /module1/form
, /module2/form
, ..., /moduleN/form
(say these are forms that you embed for a set of N teaching modules)
If N
was unknown at compile time then you couldn't put these paths in package.json. Even if N
was known, if it was equal to 100 or 1000, then you'd have a massive package.json that could be solved by the extra path config coming from a JS file using a loop.
Anyway, again, I don't need this for my use case so I don't want to overcomplicate the discussion - it just depends how flexible you'd like this configuration to be.
from react-snapshot.
Sorry for dropping this for a while. I think in the case you describe, it probably makes more sense to make like a index page for all the URLs you can't otherwise reach, call it like __index.html
or something. If you put a hidden link on your homepage, or point react-snapshot at it directly in package.json, the crawler will find it and cache all those routes.
I think that's better than having an executable config.
from react-snapshot.
Related Issues (20)
- Starting crawling fail for the query string parameters url
- Snapshot of async re-render (setState) HOT 3
- Error when building when <canvas /> is being used HOT 6
- Can't build with react-snapshot anymore. /build/ doesn't generate .html HOT 4
- Anchor tags with href="javascript;void(0);" will break HOT 1
- Does not prerender anymore with styled-components v3 or v4 HOT 1
- Confusing README HOT 1
- Pass in variables
- Error: Uncaught [Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11] HOT 1
- TypeScript support HOT 3
- Why got: nginx 404 not found? HOT 1
- "RangeError: Maximum call stack size exceeded" after crawling
- Is the project still maintained?
- Invariant Violation on jsdom while using react-snapshot
- issue with node-fetch: TypeError: Cannot set property 'Headers' of undefined
- Link to Phenomic (https://phenomic.io/) in `README.md` goes to domain expired page.
- npm run build error when using react-snapshot HOT 1
- Can this be used with React Native Web/Expo?
- ‘TypeError: window.matchMedia is not a function’ error HOT 1
- Incompatible with React >18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-snapshot.