From 247dd98cf377f4c663b137632244a974cdc7c500 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 29 Jun 2017 05:55:13 +0530 Subject: [PATCH] Add a better filename to the dynamic import chunk. (#2397) With this we can see the import name in the filename. This helps a lot in debugging and analyzing the webpack bundle. --- server/build/babel/plugins/handle-import.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/build/babel/plugins/handle-import.js b/server/build/babel/plugins/handle-import.js index 3a11ccae..d1f661d7 100644 --- a/server/build/babel/plugins/handle-import.js +++ b/server/build/babel/plugins/handle-import.js @@ -45,8 +45,10 @@ export default () => ({ visitor: { CallExpression (path) { if (path.node.callee.type === TYPE_IMPORT) { + const moduleName = path.node.arguments[0].value + const name = `${moduleName.replace(/[^\w]/g, '-')}-${UUID.v4()}` const newImport = buildImport({ - name: UUID.v4() + name })({ SOURCE: path.node.arguments })