stereobooster / react-snap

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

Ignore some Script tags during the build phase #500

Open victorsferreira opened 3 years ago

victorsferreira commented 3 years ago

I am aware that the options aren't yet documented. As stated in the docs, I checked the index.js for the defaultOptions object.

https://github.com/stereobooster/react-snap/blob/master/index.js

I saw some of the options and checked some related questions on StackOverflow (like this one https://stackoverflow.com/questions/55555597/prevent-react-snap-from-putting-all-js-script-links-into-generated-files).

It would be good if we could tell react-snap to not add some of the script files in the generated bundle and keep them only in the HTML.

In the project I am working on, there are some third-party scripts and we have no control over them. In my specific case we end up injecting this external code twice in the project.

We could mark the desired scripts with some data- or class attributes or anything that makes a better practice.

https://www.w3schools.com/tags/ref_standardattributes.asp