Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The stats data includes strange strings like ` + 4 modules' #8507

Closed
tanin47 opened this issue Dec 15, 2018 · 4 comments
Closed

The stats data includes strange strings like ` + 4 modules' #8507

tanin47 opened this issue Dec 15, 2018 · 4 comments

Comments

@tanin47
Copy link

tanin47 commented Dec 15, 2018

Bug report

What is the current behavior?

The stats data includes strange string:

{
  "moduleId": 14,
  "moduleIdentifier": "/projects/sbt-vuefy/node_modules/vue-loader/lib/index.js??vue-loader-options!/projects/sbt-vuefy/src/test/scala/givers/vuefy/assets/vue/component-a.vue e03f6658ab7c5e6582e13283490782d2",
  "module": "./vue/component-a.vue + 4 modules",
  "moduleName": "./vue/component-a.vue + 4 modules",
  "type": "harmony import specifier",
  "userRequest": "./dependencies/component-b.vue",
  "loc": "7:29-39"
}

If the current behavior is a bug, please provide the steps to reproduce.

The stats data above can be generated using the below plugin:

class Plugin {
  apply(compiler) {
    compiler.hooks.emit.tap("emit-hook", (compilation) => {
      for (let module of compilation.getStats().toJson().modules) {
        for (let reason of module.reasons) {
          console.log(JSON.stringify(reason));
        }
      }
    });
  }
}

What is the expected behavior?

Can we remove the string + 4 modules in "moduleName": "./vue/component-a.vue + 4 modules"?

Other relevant information:
webpack version: 4.27.1
Node.js version: 9.0.0
Operating System: Ubuntu 18.04 LTS
Additional tools: I'm using vue-loader with webpack. So, I'm not sure who adds these strange strings.

@niieani
Copy link
Contributor

niieani commented Dec 15, 2018

This simply means that the module was concatenated to include 4 other modules. You can disable this optimization if you want to see the correct dependency tree in the stats data.

@tanin47
Copy link
Author

tanin47 commented Dec 15, 2018

Thank you @niieani. So, it is not a bug.

I have two follow-up questions:

  • How do I turn of the optimization you are talking about?
  • Where is the location of the code that is responsible? (I'd like to learn).

Thank you again.

@niieani
Copy link
Contributor

niieani commented Dec 15, 2018

Here you can turn it off:

https://webpack.js.org/configuration/optimization/#optimization-concatenatemodules

This is where it comes from in the code:

readableIdentifier(requestShortener) {
return (
this.rootModule.readableIdentifier(requestShortener) +
` + ${this._numberOfConcatenatedModules - 1} modules`
);
}

@tanin47
Copy link
Author

tanin47 commented Dec 15, 2018

Thank you!

@tanin47 tanin47 closed this as completed Dec 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants