Skip to content

Commit

Permalink
feat: load deps needed for sdk in ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 2, 2020
1 parent d24fc97 commit 2693fee
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,36 @@
* See: https://www.gatsbyjs.org/docs/ssr-apis/
*/

// You can delete this file if you're not using it
// This is needed to ensure the NR1 SDK can load properly
const React = require('react');

exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
replaceHeadComponents([
...getHeadComponents(),
<script
key="react"
crossOrigin="anonymous"
src="//nr1.nr-assets.net/lib/react/16.6.3/react.development.js"
/>,
<script
key="react-dom"
crossOrigin="anonymous"
src="//nr1.nr-assets.net/lib/react/16.6.3/react-dom.development.js"
/>,
<script
key="react-router"
crossOrigin="anonymous"
src="//nr1.nr-assets.net/lib/react-router/4.2.0/react-router.js"
/>,
<script
key="react-router-dom"
crossOrigin="anonymous"
src="//nr1.nr-assets.net/lib/react-router-dom/4.2.2/react-router-dom.js"
/>,
<script
key="d3"
crossOrigin="anonymous"
src="//nr1.nr-assets.net/lib/d3/3.5.17/d3.js"
/>,
]);
};

0 comments on commit 2693fee

Please sign in to comment.