Skip to content

Commit

Permalink
warn only in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinjude authored and tyhopp committed May 19, 2022
1 parent bba743e commit 55d5650
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/gatsby-script/src/gatsby-script.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ function injectScript(props: ScriptProps): HTMLScriptElement | null {
if (scriptCache.has(scriptKey)) {
if (onLoad) onLoad(new Event(`load`))

if (scriptKey && scripts[scriptKey]?.strategy !== strategy) {
const isDevelop = process.env.NODE_ENV === `development`

if (scriptKey && scripts[scriptKey]?.strategy !== strategy && isDevelop) {
console.warn(
`Script ${scriptKey} is already loaded with a different strategy. Consider removing duplicates`
)
Expand Down

0 comments on commit 55d5650

Please sign in to comment.