-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question v2] Gatsby script loader in external file #8025
Comments
@pieh any inputs on this? |
For clarification there is two ways I can think of that would work for me. One is that the script is loaded externally. I think this would mean the script loader would have to be generated for each page. The other idea I had was in
This would work if |
I think it would be valid change to move |
Here's the file that handles that - https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/static-entry.js - right now you don't have access for it, because we run |
@pieh sure thing, would it be valid to move the |
yeah, I think moving apiRunner(`onPreRenderHTML`, {
getHeadComponents,
replaceHeadComponents,
getPreBodyComponents,
replacePreBodyComponents,
getPostBodyComponents,
replacePostBodyComponents,
}) to right before
makes sense |
Is there a way that I can have Gatsby load
<script id="gatsby-script-loader">
from an external script file (without manually moving it) ? I would like to setcontent-security-policy
headers to not allow inline scripts for security and since this is the only inline script generated for most of my pages I thought it was worth asking. Thanks!Update: This script also doesn't show up during onPreRenderHTML, is there a way to obtain a reference to the component or is it injected by webpack into the page output ?
The text was updated successfully, but these errors were encountered: