Commit b37fcbb5 authored by Alex Castle's avatar Alex Castle Committed by Tim Neutkens

Prevent CSS script tags in granular chunks (#9306)

* Don't add script tags for css files on client side navigation with granular chunks

* Filter for JS, instead of against CSS
parent 9defdd0a
...@@ -98,7 +98,7 @@ export default class PageLoader { ...@@ -98,7 +98,7 @@ export default class PageLoader {
if (process.env.__NEXT_GRANULAR_CHUNKS) { if (process.env.__NEXT_GRANULAR_CHUNKS) {
this.getDependencies(route).then(deps => { this.getDependencies(route).then(deps => {
deps.forEach(d => { deps.forEach(d => {
if (!document.querySelector(`script[src^="${d}"]`)) { if (/\.js$/.test(d) && !document.querySelector(`script[src^="${d}"]`)) {
this.loadScript(d, route, false) this.loadScript(d, route, false)
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment