{"action":"closed","issue":{"url":"https://api.github.com/repos/vuejs/vue-loader/issues/1278","repository_url":"https://api.github.com/repos/vuejs/vue-loader","labels_url":"https://api.github.com/repos/vuejs/vue-loader/issues/1278/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-loader/issues/1278/comments","events_url":"https://api.github.com/repos/vuejs/vue-loader/issues/1278/events","html_url":"https://github.com/vuejs/vue-loader/issues/1278","id":319251764,"number":1278,"title":"VueLoaderPlugin causes loaders to run several times","user":{"login":"killerDJO","id":2312418,"avatar_url":"https://avatars0.githubusercontent.com/u/2312418?v=4","gravatar_id":"","url":"https://api.github.com/users/killerDJO","html_url":"https://github.com/killerDJO","followers_url":"https://api.github.com/users/killerDJO/followers","following_url":"https://api.github.com/users/killerDJO/following{/other_user}","gists_url":"https://api.github.com/users/killerDJO/gists{/gist_id}","starred_url":"https://api.github.com/users/killerDJO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killerDJO/subscriptions","organizations_url":"https://api.github.com/users/killerDJO/orgs","repos_url":"https://api.github.com/users/killerDJO/repos","events_url":"https://api.github.com/users/killerDJO/events{/privacy}","received_events_url":"https://api.github.com/users/killerDJO/received_events","type":"User","site_admin":false},"labels":[{"id":134164762,"url":"https://api.github.com/repos/vuejs/vue-loader/labels/bug","name":"bug","color":"b60205","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-01T16:38:22Z","updated_at":"2018-05-02T20:51:17Z","closed_at":"2018-05-02T20:51:17Z","author_association":"NONE","body":"### Version\r\n15.0.0\r\n\r\n### Reproduction link\r\n[https://github.com/killerDJO/vue-loader-minimal](https://github.com/killerDJO/vue-loader-minimal)\r\n\r\n### Steps to reproduce\r\nPrererquisites:\r\n- ts-loader is used and has options specified (Important!).\r\n- SFC with referenced TypeScript file is used.\r\n\r\nRun webpack build using mentioned configuration. Rules might look like this:\r\n```\r\nmodule: {\r\n    rules: [\r\n        {\r\n            test: /\\.ts$/,\r\n            loader: \"ts-loader\",\r\n            options: {},\r\n            exclude: [/node_modules/]\r\n        },\r\n        {\r\n            test: /\\.vue$/,\r\n            loader: \"vue-loader\",\r\n        }\r\n    ]\r\n},\r\nresolve: {\r\n    extensions: [\".ts\"],\r\n},\r\nplugins: [\r\n    new VueLoaderPlugin()\r\n],\r\n```\r\n\r\n### What is expected?\r\nBuild is finished successfully.\r\n\r\n### What is actually happening?\r\nBuild failed.\r\n\r\n---\r\nIn the current implementation VueLoaderPlugin clones webpack rules and modifies them to run on .vue files. However, this leads to an issues when a file is referenced from .vue component (e. g.  `<script src=\"./App.ts\" lang=\"ts\"></script>`). In this case the file can be matched by two rules (original and cloned) and ts-loader will be executed two times, with second time executing using output of the first run. \r\nThis will happend only if \"options\" object is specified, because otherwise webpack will use a single loader for two rules (VueLoaderPlugin removes \"options\" during rules cloning, so only original rule will have options).\r\n\r\nAforementioned behaviour has been observed for ts-loader, but is likely to occur for scss/sass loaders as well.\r\n\r\n<!-- generated by vue-issues. DO NOT REMOVE -->"}}
{"actor":{"display_login":"yyx990803"}}