Commit 247dd98c authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

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.
parent 765642ca
...@@ -45,8 +45,10 @@ export default () => ({ ...@@ -45,8 +45,10 @@ export default () => ({
visitor: { visitor: {
CallExpression (path) { CallExpression (path) {
if (path.node.callee.type === TYPE_IMPORT) { 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({ const newImport = buildImport({
name: UUID.v4() name
})({ })({
SOURCE: path.node.arguments SOURCE: path.node.arguments
}) })
......
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