{"action":"created","issue":{"url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/11","repository_url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin","labels_url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/11/comments","events_url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/11/events","html_url":"https://github.com/numical/style-ext-html-webpack-plugin/issues/11","id":197468469,"number":11,"title":"webpack 2.2.0-rc.2: \"TypeError: Cannot read property 'size' of undefined\"","user":{"login":"jdb8","id":643295,"avatar_url":"https://avatars.githubusercontent.com/u/643295?v=3","gravatar_id":"","url":"https://api.github.com/users/jdb8","html_url":"https://github.com/jdb8","followers_url":"https://api.github.com/users/jdb8/followers","following_url":"https://api.github.com/users/jdb8/following{/other_user}","gists_url":"https://api.github.com/users/jdb8/gists{/gist_id}","starred_url":"https://api.github.com/users/jdb8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdb8/subscriptions","organizations_url":"https://api.github.com/users/jdb8/orgs","repos_url":"https://api.github.com/users/jdb8/repos","events_url":"https://api.github.com/users/jdb8/events{/privacy}","received_events_url":"https://api.github.com/users/jdb8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-24T16:03:03Z","updated_at":"2016-12-28T00:48:44Z","closed_at":null,"body":"On the latest webpack RC (v2.2.0-rc.2), using the plugin produces the following traceback:\r\n\r\n```\r\n/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:37\r\n\t\t\t\t\treturn compilation.assets[file].size()\r\n\t\t\t\t\t                               ^\r\n\r\nTypeError: Cannot read property 'size' of undefined\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:37:37\r\n    at Array.map (native)\r\n    at getEntrypointSize (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:36:6)\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:64:16\r\n    at Array.forEach (native)\r\n    at Compiler.<anonymous> (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:62:5)\r\n    at Compiler.applyPluginsAsyncSeries1 (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/tapable/lib/Tapable.js:122:13)\r\n    at Compiler.afterEmit (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/Compiler.js:340:8)\r\n    at Compiler.<anonymous> (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/webpack/lib/Compiler.js:335:14)\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/async/dist/async.js:356:16\r\n    at iteratorCallback (/Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/async/dist/async.js:936:13)\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/async/dist/async.js:840:16\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/graceful-fs/graceful-fs.js:43:10\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/graceful-fs/graceful-fs.js:43:10\r\n    at /Users/jb/code/style-ext-html-webpack-plugin/dynavers_modules/webpack-2.2.0-rc.2/node_modules/graceful-fs/graceful-fs.js:43:10\r\n    at FSReqWrap.oncomplete (fs.js:123:15)\r\n```\r\n\r\n(this was produced from upgrading the version of webpack 2 used during test and running `npm run test:webpack2`). The same error occurs when using the plugin with a real toy project.\r\n\r\nA quick glance appears to show the cause is the line deleting the extracted css file: https://github.com/numical/style-ext-html-webpack-plugin/blob/3e17a2517df6b733e13942b415870ca24adc735b/lib/plugin.js#L107 - apparently the (new?) SizeLimitsPlugin is expecting it to exist: https://github.com/webpack/webpack/blob/8bc25f65e60001861a2c9f9962ddfbe3a5aa9025/lib/performance/SizeLimitsPlugin.js#L37. Removing the deletion line appears to work, although the tests fail since they're currently testing that the file is deleted.\r\n\r\nI'm not sure whether this is more of a bug with webpack, or if the recommendation is for plugins to avoid deleting emitted assets created by other plugins? At this point my knowledge of webpack plugin execution order and interop is limited, so please let me know if I should create an issue on webpack itself."},"comment":{"url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/comments/269404399","html_url":"https://github.com/numical/style-ext-html-webpack-plugin/issues/11#issuecomment-269404399","issue_url":"https://api.github.com/repos/numical/style-ext-html-webpack-plugin/issues/11","id":269404399,"user":{"login":"jdb8","id":643295,"avatar_url":"https://avatars.githubusercontent.com/u/643295?v=3","gravatar_id":"","url":"https://api.github.com/users/jdb8","html_url":"https://github.com/jdb8","followers_url":"https://api.github.com/users/jdb8/followers","following_url":"https://api.github.com/users/jdb8/following{/other_user}","gists_url":"https://api.github.com/users/jdb8/gists{/gist_id}","starred_url":"https://api.github.com/users/jdb8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdb8/subscriptions","organizations_url":"https://api.github.com/users/jdb8/orgs","repos_url":"https://api.github.com/users/jdb8/repos","events_url":"https://api.github.com/users/jdb8/events{/privacy}","received_events_url":"https://api.github.com/users/jdb8/received_events","type":"User","site_admin":false},"created_at":"2016-12-28T00:48:44Z","updated_at":"2016-12-28T00:48:44Z","body":"@numical: no problem, thanks for taking a look.\r\n\r\nI did a little more investigation and I'm leaning towards the opinion that this should be fixed on the webpack side. I can't find anything that officially discourages deletion of compilation assets during/after emit (although trying to google this stuff is basically impossible), and the code in the SizeLimitsPlugin seems easily refactor-able to simply ignore anything that's no longer in the set of assets. Additionally, a quick search seems to show that it's not just you doing it this way: https://github.com/search?q=%22delete+compilation.assets%22&ref=searchresults&type=Code&utf8=%E2%9C%93 - so any of these plugins would also be affected.\r\n\r\nI'll likely create an issue/PR on webpack when I get around to it and see what they think about this. It's possible there's an alternative supported method for removing emitted assets. I tried briefly asking in the gitter but didn't get a response so far.\r\n\r\nAs for RC/betas breaking stuff, I feel your pain. But it's at least nice to find this stuff before v2 is released for real I guess ;)"}}
{"actor":{"display_login":"jdb8"}}