{"action":"closed","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/6781","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/6781/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/6781/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/6781/events","html_url":"https://github.com/webpack/webpack/issues/6781","id":306141695,"node_id":"MDU6SXNzdWUzMDYxNDE2OTU=","number":6781,"title":"Webpack not calling hooks in the right order?","user":{"login":"SirUppyPancakes","id":12754240,"node_id":"MDQ6VXNlcjEyNzU0MjQw","avatar_url":"https://avatars1.githubusercontent.com/u/12754240?v=4","gravatar_id":"","url":"https://api.github.com/users/SirUppyPancakes","html_url":"https://github.com/SirUppyPancakes","followers_url":"https://api.github.com/users/SirUppyPancakes/followers","following_url":"https://api.github.com/users/SirUppyPancakes/following{/other_user}","gists_url":"https://api.github.com/users/SirUppyPancakes/gists{/gist_id}","starred_url":"https://api.github.com/users/SirUppyPancakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirUppyPancakes/subscriptions","organizations_url":"https://api.github.com/users/SirUppyPancakes/orgs","repos_url":"https://api.github.com/users/SirUppyPancakes/repos","events_url":"https://api.github.com/users/SirUppyPancakes/events{/privacy}","received_events_url":"https://api.github.com/users/SirUppyPancakes/received_events","type":"User","site_admin":false},"labels":[{"id":433079799,"node_id":"MDU6TGFiZWw0MzMwNzk3OTk=","url":"https://api.github.com/repos/webpack/webpack/labels/X2:%20answer%20required","name":"X2: answer required","color":"fbca04","default":false},{"id":665191202,"node_id":"MDU6TGFiZWw2NjUxOTEyMDI=","url":"https://api.github.com/repos/webpack/webpack/labels/inactive","name":"inactive","color":"000000","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-17T09:18:52Z","updated_at":"2018-12-22T07:11:54Z","closed_at":"2018-12-22T07:11:54Z","author_association":"NONE","body":"<!-- Please don't delete this template or we'll close your issue -->\r\n<!-- Before creating an issue please make sure you are using the latest version of webpack. -->\r\n<!-- Also consider trying the webpack@beta version, maybe it's already fixed. -->\r\n\r\n**Do you want to request a *feature* or report a *bug*?**\r\n\r\nbug/feature\r\n\r\n<!-- Please ask questions on StackOverflow or the webpack Gitter (https://gitter.im/webpack/webpack). -->\r\n<!-- Issues which contain questions or support requests will be closed. -->\r\n\r\n**What is the current behavior?**\r\n\r\nWhen writing a plugin and using `compiler.hooks` or `compilation.hooks`, hooks like `afterEmit`, `afterCompile`, and `done` are called before the actual compilation info/errors/warnings are logged to the console.\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce.**\r\n\r\n[webpack_hook_issue.zip](https://github.com/webpack/webpack/files/1821441/webpack_hook_issue.zip)\r\nUnzip the attachment, navigate to the root of the node application, run `yarn install` or `npm install`, and then `yarn webpack` or `npm run webpack`.\r\n\r\nInside of `webpack.config.js`, I have registered a small plugin, inline, which taps all of the hooks in `compiler.hooks` and `compilation.hooks` and logs a message.\r\n\r\nAs you make changes to `src/test.js`, you will notice that the output shows all of the hooks getting logged before the final bits of text:\r\n\r\nInfo:\r\n```\r\n...\r\nwebpack: compilation.needAdditionalSeal\r\nwebpack: compilation.afterSeal\r\nwebpack: afterCompile\r\nwebpack: shouldEmit\r\nwebpack: emit\r\nwebpack: afterEmit\r\nwebpack: compilation.needAdditionalPass\r\nwebpack: done\r\nHash: 8425def6e9a1fc30c3bc\r\nVersion: webpack 4.1.1\r\nTime: 89ms\r\nBuilt at: 2018-3-17 01:58:21\r\n         Asset      Size  Chunks             Chunk Names\r\n    Console.js  4.89 KiB    main  [emitted]  main\r\nConsole.js.map   4.7 KiB    main  [emitted]  main\r\nEntrypoint main = Console.js Console.js.map\r\n[./src/test.js] 116 bytes {main} [built]\r\n    + 1 hidden module\r\n```\r\n\r\nWarnings:\r\n```\r\n...\r\nwebpack: emit\r\nwebpack: afterEmit\r\nwebpack: compilation.needAdditionalPass\r\nwebpack: done\r\nHash: d967bd3004e17b298d7e\r\nVersion: webpack 4.1.1\r\nTime: 67ms\r\nBuilt at: 2018-3-17 02:02:01\r\n         Asset      Size  Chunks             Chunk Names\r\n    Console.js  3.68 KiB    main  [emitted]  main\r\nConsole.js.map  3.36 KiB    main  [emitted]  main\r\nEntrypoint main = Console.js Console.js.map\r\n[./src sync recursive] ./src sync 160 bytes {main} [built]\r\n[./src/test.js] 136 bytes {main} [built]\r\n\r\nWARNING in ./src/test.js\r\n2:16-29 Critical dependency: the request of a dependency is an expression\r\n @ ./src/test.js\r\n```\r\n\r\nErrors:\r\n```\r\n...\r\nwebpack: compilation.needAdditionalPass\r\nwebpack: done\r\nHash: ac3697133c4a4ef0999f\r\nVersion: webpack 4.1.1\r\nTime: 30ms\r\nBuilt at: 2018-3-17 02:02:33\r\n         Asset      Size  Chunks             Chunk Names\r\n    Console.js   3.2 KiB    main  [emitted]  main\r\nConsole.js.map  2.72 KiB    main  [emitted]  main\r\nEntrypoint main = Console.js Console.js.map\r\n[./src/test.js] 206 bytes {main} [built] [failed] [1 error]\r\n\r\nERROR in ./src/test.js\r\nModule parse failed: Unexpected token (1:18)\r\nYou may need an appropriate loader to handle this file type.\r\n| const leftPad = r equire(\"left-pad\");\r\n|\r\n| console.log(\"hello\");\r\n```\r\n\r\n<!-- A great way to do this is to provide your configuration via a GitHub gist. -->\r\n<!-- Best provide a minimal reproduceable repo -->\r\n<!-- If your issue is caused by a plugin or loader file the issue on the plugin/loader repo -->\r\n\r\n**What is the expected behavior?**\r\n\r\nSince Webpack does not output messages like `Compilation started`, `Compilation completed successfully`, `Compilation completed with warnings`, or `Compilation completed with errors` (which would be super helpful as a default config or any config), I attempted to make this small plugin, only to find that it couldn't handle a situation like this.\r\n\r\n**If this is a feature request, what is motivation or use case for changing the behavior?**\r\n\r\nVisual Studio Code problem-matchers: [vscode-problem-matchers-docs](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher)\r\nThese use regex to detect sections of standard output that potentially have 'problems' and show them in the IDE, very cool stuff. Without messages from Webpack, we can't define robust matchers.\r\n\r\n**Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.**\r\n```\r\nwebpack: 4.1.1\r\nwebpack-cli: 2.0.12\r\nnode: v8.9.4\r\nnpm: 5.6.0\r\nyarn: 1.5.1\r\nvscode: 1.21.1\r\nwindows: 10.0.16299 build 16299\r\n\r\n```\r\n"}}
{"actor":{"display_login":"webpack-bot"}}