From 52dfd6e939d04c1e90b279adf0b247bc8c9f1e8c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 18 Mar 2018 16:31:53 -0700 Subject: [PATCH] Don't preload .map files --- src/middleware.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 8f0f06e..8e87da1 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -149,6 +149,7 @@ function get_route_handler(chunks: Record, routes: RouteObject[] // TODO detect other stuff we can preload? images, CSS, fonts? const link = [] .concat(chunks.main, chunks[route.id]) + .filter(file => !file.match(/\.map$/)) .map(file => `<${req.baseUrl}/client/${file}>;rel="preload";as="script"`) .join(', '); @@ -198,7 +199,7 @@ function get_route_handler(chunks: Record, routes: RouteObject[] let scripts = [] .concat(chunks.main) // chunks main might be an array. it might not! thanks, webpack - .filter(function (file) { return !file.match(/\.map$/); }) + .filter(file => !file.match(/\.map$/)) .map(file => ``) .join('');