Commit ebb39f10 authored by Janicklas Ralph's avatar Janicklas Ralph Committed by Tim Neutkens

Allow only JS files when loading dynamic chunks (#8831)

parent 85e720a0
...@@ -152,7 +152,7 @@ export class Head extends Component< ...@@ -152,7 +152,7 @@ export class Head extends Component<
return files.map((file: string) => { return files.map((file: string) => {
// Only render .css files here // Only render .css files here
if (!/\.css$/.exec(file)) { if (!/\.css$/.test(file)) {
return null return null
} }
...@@ -516,7 +516,7 @@ export class NextScript extends Component<OriginProps> { ...@@ -516,7 +516,7 @@ export class NextScript extends Component<OriginProps> {
: { noModule: true } : { noModule: true }
} }
if (files.includes(bundle.file)) return null if (!/\.js$/.test(bundle.file) || files.includes(bundle.file)) return null
return ( return (
<script <script
...@@ -542,7 +542,7 @@ export class NextScript extends Component<OriginProps> { ...@@ -542,7 +542,7 @@ export class NextScript extends Component<OriginProps> {
return files.map((file: string) => { return files.map((file: string) => {
// Only render .js files here // Only render .js files here
if (!/\.js$/.exec(file)) { if (!/\.js$/.test(file)) {
return null return null
} }
......
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