1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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.
This commit is contained in:
Arunoda Susiripala 2017-06-29 05:55:13 +05:30 committed by GitHub
parent 765642caf7
commit 247dd98cf3

View file

@ -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
})