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

[VueLoaderPlugin Error] No matching rule for .vue files found - when files have different extension than .vue #1238

Closed
roysanchez opened this issue Apr 11, 2018 · 17 comments

Comments

@roysanchez
Copy link

roysanchez commented Apr 11, 2018

Version

15.0.0-rc.1

Reproduction link

N/A

Steps to reproduce

const path = require('path');
const webpack = require('webpack');
const { VueLoaderPlugin } = require('vue-loader')


module.exports = (env) => {
   const isDevBuild = !(env && env.prod);

   return [{
       stats: { modules: false },
       context: __dirname,
       resolve: { extensions: [ '.js', '.ts' ] },
       entry: { 'main': './ClientApp/boot.ts' },
       module: {
            rules: [
                { test: /\.vue\.html$/, loader: 'vue-loader' },  //Change this line to { test: /\.vue/, loader: 'vue-loader' } to make it work
                { test: /\.ts$/, use: 'ts-loader?silent=true' }
            ]
        },
       output: {
           path: path.join(__dirname,  './wwwroot/dist'),
           filename: '[name].js',
           publicPath: 'dist/'
       },
       plugins: [
           new VueLoaderPlugin()
       ]
   }];

};

What is expected?

The bundle is successful

What is actually happening?

Webpack throws the following error:
[VueLoaderPlugin Error] No matching rule for .vue files found.
Make sure there is at least one root-level rule that matches .vue files.

@yyx990803
Copy link
Member

Why are you using .vue.html extension instead of just .vue?

@roysanchez
Copy link
Author

roysanchez commented Apr 12, 2018 via email

@yyx990803
Copy link
Member

yyx990803 commented Apr 12, 2018

Well, Vue SFCs are not technically HTML. The recommended approach is using the proper .vue extension and VSCode (which has excellent SFC support via the Vetur extension) instead Visual Studio.

If you really want to stick with vue.html, you can workaround this by having both rules:

rules: [
  { test: /\.vue$/, loader: 'vue-loader' },
  { test: /\.vue\.html$/, loader: 'vue-loader' }
]

@roysanchez
Copy link
Author

Thanks that worked even thought it looks like a hack 😅 as I don't have any .vue files in the project

@yyx990803
Copy link
Member

@roysanchez I added a special case for .vue.html. Will work without the extra rule in the next release.

@BrainBacon
Copy link

@yyx990803 I have a similar issue. My .vue files have become .pug instead. Is there any chance we can have a configurable option instead of just handling special cases?

@Flamenco
Copy link

Why not just add an optional regex to the current instruction?
rules: [
{ test: /.vue(.html)?$/, loader: 'vue-loader' },
]

@BrainBacon
Copy link

@Flamenco the loader was working only when there was a rule for .vue specifically, hence the need to have multiple rules. I don't know if this is still the case.

eliperelman referenced this issue in neutrinojs/neutrino Jun 15, 2018
This Pull Request updates dependency [vue-loader](https://github.com/vuejs/vue-loader) from `^14.2.3` to `^15.0.0`



<details>
<summary>Release Notes</summary>

### [`v15.2.4`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1524httpsgithubcomvuejsvue-loadercomparev1522v1524-2018-06-01)
[Compare Source](vuejs/vue-loader@v15.2.3...v15.2.4)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* fix unexpected error when options of cache-loader contains ! ([#&#8203;1334](`https://github.com/vuejs/vue-loader/issues/1334`)) ([c4a2719](vuejs/vue-loader@c4a2719))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.3`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1523httpsgithubcomvuejsvue-loadercomparev1522v1523-2018-06-01)
[Compare Source](vuejs/vue-loader@91f420b...v15.2.3)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.2`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1524httpsgithubcomvuejsvue-loadercomparev1522v1524-2018-06-01)
[Compare Source](vuejs/vue-loader@v15.2.1...91f420b)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* fix unexpected error when options of cache-loader contains ! ([#&#8203;1334](`https://github.com/vuejs/vue-loader/issues/1334`)) ([c4a2719](vuejs/vue-loader@c4a2719))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.1`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1521httpsgithubcomvuejsvue-loadercomparev1520v1521-2018-05-25)
[Compare Source](vuejs/vue-loader@v15.2.0...v15.2.1)
##### Bug Fixes

* ensure template cache uses unique identifier ([bdb13be](vuejs/vue-loader@bdb13be))

---

### [`v15.2.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1520httpsgithubcomvuejsvue-loadercomparev1510v1520-2018-05-22)
[Compare Source](vuejs/vue-loader@v15.1.0...v15.2.0)
##### Features

* enable template compile caching ([28e0fd3](vuejs/vue-loader@28e0fd3))

---

### [`v15.1.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1520httpsgithubcomvuejsvue-loadercomparev1510v1520-2018-05-22)
[Compare Source](vuejs/vue-loader@b1ed161...v15.1.0)
##### Features

* enable template compile caching ([28e0fd3](vuejs/vue-loader@28e0fd3))

---

### [`v15.0.12`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1510httpsgithubcomvuejsvue-loadercomparev15012v1510-2018-05-19)
[Compare Source](vuejs/vue-loader@bde7db7...b1ed161)
##### Performance Improvements

* avoid duplicate linting when used with eslint-loader ([3d07f81](vuejs/vue-loader@3d07f81))
#### [15.0.12](vuejs/vue-loader@v15.0.11...v15.0.12) (2018-05-18)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)
#### [15.0.11](vuejs/vue-loader@v15.0.9...v15.0.11) (2018-05-15)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))
#### [15.0.10](vuejs/vue-loader@v15.0.9...v15.0.10) (2018-05-11)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))
#### [15.0.9](vuejs/vue-loader@v15.0.8...v15.0.9) (2018-05-04)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))
#### [15.0.8](vuejs/vue-loader@v15.0.7...v15.0.8) (2018-05-04)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)
#### [15.0.7](vuejs/vue-loader@v15.0.6...v15.0.7) (2018-05-03)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)
#### [15.0.6](vuejs/vue-loader@v15.0.5...v15.0.6) (2018-05-02)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)
#### [15.0.5](vuejs/vue-loader@v15.0.4...v15.0.5) (2018-04-30)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)
#### [15.0.4](vuejs/vue-loader@v15.0.3...v15.0.4) (2018-04-27)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))
#### [15.0.3](vuejs/vue-loader@v15.0.2...v15.0.3) (2018-04-26)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))
#### [15.0.2](vuejs/vue-loader@v15.0.1...v15.0.2) (2018-04-26)
##### Bug Fixes

* remove resource field in cloned rules (fix [#&#8203;1254](`https://github.com/vuejs/vue-loader/issues/1254`)) ([35ca03f](vuejs/vue-loader@35ca03f))
#### [15.0.1](vuejs/vue-loader@v15.0.0...v15.0.1) (2018-04-25)
##### Bug Fixes

* prioritize .vue rules in plugin (fix [#&#8203;1246](`https://github.com/vuejs/vue-loader/issues/1246`)) ([bffacd5](vuejs/vue-loader@bffacd5))
* warn missing plugin ([068bb81](vuejs/vue-loader@068bb81))

---

### [`v15.0.11`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15012httpsgithubcomvuejsvue-loadercomparev15011v15012-2018-05-18)
[Compare Source](vuejs/vue-loader@1c54780...bde7db7)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)

---

### [`v15.0.10`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15010httpsgithubcomvuejsvue-loadercomparev1509v15010-2018-05-11)
[Compare Source](vuejs/vue-loader@af7d5c2...1c54780)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))

---

### [`v15.0.9`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15011httpsgithubcomvuejsvue-loadercomparev1509v15011-2018-05-15)
[Compare Source](vuejs/vue-loader@98a1f19...af7d5c2)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))

---

### [`v15.0.8`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1509httpsgithubcomvuejsvue-loadercomparev1508v1509-2018-05-04)
[Compare Source](vuejs/vue-loader@1d610e6...98a1f19)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))

---

### [`v15.0.7`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1508httpsgithubcomvuejsvue-loadercomparev1507v1508-2018-05-04)
[Compare Source](vuejs/vue-loader@653d8f8...1d610e6)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)

---

### [`v15.0.6`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1507httpsgithubcomvuejsvue-loadercomparev1506v1507-2018-05-03)
[Compare Source](vuejs/vue-loader@3c02f26...653d8f8)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)

---

### [`v15.0.5`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1506httpsgithubcomvuejsvue-loadercomparev1505v1506-2018-05-02)
[Compare Source](vuejs/vue-loader@998a573...3c02f26)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)

---

### [`v15.0.4`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1505httpsgithubcomvuejsvue-loadercomparev1504v1505-2018-04-30)
[Compare Source](vuejs/vue-loader@36d18e4...998a573)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)

---

### [`v15.0.3`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1504httpsgithubcomvuejsvue-loadercomparev1503v1504-2018-04-27)
[Compare Source](vuejs/vue-loader@d192945...36d18e4)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))

---

### [`v15.0.2`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1503httpsgithubcomvuejsvue-loadercomparev1502v1503-2018-04-26)
[Compare Source](vuejs/vue-loader@ee4d8ab...d192945)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))

---

### [`v15.0.1`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1510httpsgithubcomvuejsvue-loadercomparev15012v1510-2018-05-19)
[Compare Source](vuejs/vue-loader@v15.0.0...ee4d8ab)
##### Performance Improvements

* avoid duplicate linting when used with eslint-loader ([3d07f81](vuejs/vue-loader@3d07f81))
#### [15.0.12](vuejs/vue-loader@v15.0.11...v15.0.12) (2018-05-18)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)
#### [15.0.11](vuejs/vue-loader@v15.0.9...v15.0.11) (2018-05-15)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))
#### [15.0.10](vuejs/vue-loader@v15.0.9...v15.0.10) (2018-05-11)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))
#### [15.0.9](vuejs/vue-loader@v15.0.8...v15.0.9) (2018-05-04)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))
#### [15.0.8](vuejs/vue-loader@v15.0.7...v15.0.8) (2018-05-04)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)
#### [15.0.7](vuejs/vue-loader@v15.0.6...v15.0.7) (2018-05-03)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)
#### [15.0.6](vuejs/vue-loader@v15.0.5...v15.0.6) (2018-05-02)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)
#### [15.0.5](vuejs/vue-loader@v15.0.4...v15.0.5) (2018-04-30)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)
#### [15.0.4](vuejs/vue-loader@v15.0.3...v15.0.4) (2018-04-27)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))
#### [15.0.3](vuejs/vue-loader@v15.0.2...v15.0.3) (2018-04-26)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))
#### [15.0.2](vuejs/vue-loader@v15.0.1...v15.0.2) (2018-04-26)
##### Bug Fixes

* remove resource field in cloned rules (fix [#&#8203;1254](`https://github.com/vuejs/vue-loader/issues/1254`)) ([35ca03f](vuejs/vue-loader@35ca03f))
#### [15.0.1](vuejs/vue-loader@v15.0.0...v15.0.1) (2018-04-25)
##### Bug Fixes

* prioritize .vue rules in plugin (fix [#&#8203;1246](`https://github.com/vuejs/vue-loader/issues/1246`)) ([bffacd5](vuejs/vue-loader@bffacd5))
* warn missing plugin ([068bb81](vuejs/vue-loader@068bb81))

---

### [`v15.0.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1500httpsgithubcomvuejsvue-loadercomparev1500-rc2v1500-2018-04-24)
[Compare Source](vuejs/vue-loader@6430bc0...v15.0.0)
##### Bug Fixes

* compat with null-loader (close [#&#8203;1239](`https://github.com/vuejs/vue-loader/issues/1239`)) ([5cd5f6f](vuejs/vue-loader@5cd5f6f))
##### Features

* support declaring rules using .vue.html (ref [#&#8203;1238](`https://github.com/vuejs/vue-loader/issues/1238`)) ([a3af6b3](vuejs/vue-loader@a3af6b3))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
@dietergeerts
Copy link

Hi, I encountered the same error. The plugin is too restrictive in checking the rules. This is what I have:

        // We need to fool the VueLoaderPlugin, as that checks if a rule is available
        // for vue components, but it can't see our more restricted one....
        // It even checks the name of the loader, so aliasing also doesn't work.
        {
          test: /\.vue$/,
          include: path.resolve(__dirname),
          loader: 'vue-loader',
        },
        {
          test: /\.vue$/,
          include: options.sourceDirectory,
          issuer: /\.docs\.md$/,
          use: [
            { loader: 'fb-inject-vue-loader' },
            { loader: 'fb-vue-loader' },
          ],
        },

This comes from a package we make that is to be used with other packages, so we do aliasing to be sure that the others can use different versions of loaders etc...

acconrad referenced this issue in acconrad/neutrino-dev Jul 13, 2018
This Pull Request updates dependency [vue-loader](https://github.com/vuejs/vue-loader) from `^14.2.3` to `^15.0.0`



<details>
<summary>Release Notes</summary>

### [`v15.2.4`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1524httpsgithubcomvuejsvue-loadercomparev1522v1524-2018-06-01)
[Compare Source](vuejs/vue-loader@v15.2.3...v15.2.4)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* fix unexpected error when options of cache-loader contains ! ([#&#8203;1334](`https://github.com/vuejs/vue-loader/issues/1334`)) ([c4a2719](vuejs/vue-loader@c4a2719))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.3`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1523httpsgithubcomvuejsvue-loadercomparev1522v1523-2018-06-01)
[Compare Source](vuejs/vue-loader@91f420b...v15.2.3)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.2`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1524httpsgithubcomvuejsvue-loadercomparev1522v1524-2018-06-01)
[Compare Source](vuejs/vue-loader@v15.2.1...91f420b)
##### Bug Fixes

* ensure plugin error is emitted only once ([0b006a3](vuejs/vue-loader@0b006a3))
* fix unexpected error when options of cache-loader contains ! ([#&#8203;1334](`https://github.com/vuejs/vue-loader/issues/1334`)) ([c4a2719](vuejs/vue-loader@c4a2719))
* use constant plugin NS ([0fb5172](vuejs/vue-loader@0fb5172)), closes [#&#8203;1331](`https://github.com/vuejs/vue-loader/issues/1331`)
##### Features

* inject issuerPath to resourceQuery for custom block src imports ([#&#8203;1313](`https://github.com/vuejs/vue-loader/issues/1313`)) ([a004e30](vuejs/vue-loader@a004e30))

---

### [`v15.2.1`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1521httpsgithubcomvuejsvue-loadercomparev1520v1521-2018-05-25)
[Compare Source](vuejs/vue-loader@v15.2.0...v15.2.1)
##### Bug Fixes

* ensure template cache uses unique identifier ([bdb13be](vuejs/vue-loader@bdb13be))

---

### [`v15.2.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1520httpsgithubcomvuejsvue-loadercomparev1510v1520-2018-05-22)
[Compare Source](vuejs/vue-loader@v15.1.0...v15.2.0)
##### Features

* enable template compile caching ([28e0fd3](vuejs/vue-loader@28e0fd3))

---

### [`v15.1.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1520httpsgithubcomvuejsvue-loadercomparev1510v1520-2018-05-22)
[Compare Source](vuejs/vue-loader@b1ed161...v15.1.0)
##### Features

* enable template compile caching ([28e0fd3](vuejs/vue-loader@28e0fd3))

---

### [`v15.0.12`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1510httpsgithubcomvuejsvue-loadercomparev15012v1510-2018-05-19)
[Compare Source](vuejs/vue-loader@bde7db7...b1ed161)
##### Performance Improvements

* avoid duplicate linting when used with eslint-loader ([3d07f81](vuejs/vue-loader@3d07f81))
#### [15.0.12](vuejs/vue-loader@v15.0.11...v15.0.12) (2018-05-18)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)
#### [15.0.11](vuejs/vue-loader@v15.0.9...v15.0.11) (2018-05-15)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))
#### [15.0.10](vuejs/vue-loader@v15.0.9...v15.0.10) (2018-05-11)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))
#### [15.0.9](vuejs/vue-loader@v15.0.8...v15.0.9) (2018-05-04)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))
#### [15.0.8](vuejs/vue-loader@v15.0.7...v15.0.8) (2018-05-04)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)
#### [15.0.7](vuejs/vue-loader@v15.0.6...v15.0.7) (2018-05-03)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)
#### [15.0.6](vuejs/vue-loader@v15.0.5...v15.0.6) (2018-05-02)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)
#### [15.0.5](vuejs/vue-loader@v15.0.4...v15.0.5) (2018-04-30)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)
#### [15.0.4](vuejs/vue-loader@v15.0.3...v15.0.4) (2018-04-27)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))
#### [15.0.3](vuejs/vue-loader@v15.0.2...v15.0.3) (2018-04-26)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))
#### [15.0.2](vuejs/vue-loader@v15.0.1...v15.0.2) (2018-04-26)
##### Bug Fixes

* remove resource field in cloned rules (fix [#&#8203;1254](`https://github.com/vuejs/vue-loader/issues/1254`)) ([35ca03f](vuejs/vue-loader@35ca03f))
#### [15.0.1](vuejs/vue-loader@v15.0.0...v15.0.1) (2018-04-25)
##### Bug Fixes

* prioritize .vue rules in plugin (fix [#&#8203;1246](`https://github.com/vuejs/vue-loader/issues/1246`)) ([bffacd5](vuejs/vue-loader@bffacd5))
* warn missing plugin ([068bb81](vuejs/vue-loader@068bb81))

---

### [`v15.0.11`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15012httpsgithubcomvuejsvue-loadercomparev15011v15012-2018-05-18)
[Compare Source](vuejs/vue-loader@1c54780...bde7db7)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)

---

### [`v15.0.10`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15010httpsgithubcomvuejsvue-loadercomparev1509v15010-2018-05-11)
[Compare Source](vuejs/vue-loader@af7d5c2...1c54780)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))

---

### [`v15.0.9`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;15011httpsgithubcomvuejsvue-loadercomparev1509v15011-2018-05-15)
[Compare Source](vuejs/vue-loader@98a1f19...af7d5c2)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))

---

### [`v15.0.8`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1509httpsgithubcomvuejsvue-loadercomparev1508v1509-2018-05-04)
[Compare Source](vuejs/vue-loader@1d610e6...98a1f19)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))

---

### [`v15.0.7`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1508httpsgithubcomvuejsvue-loadercomparev1507v1508-2018-05-04)
[Compare Source](vuejs/vue-loader@653d8f8...1d610e6)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)

---

### [`v15.0.6`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1507httpsgithubcomvuejsvue-loadercomparev1506v1507-2018-05-03)
[Compare Source](vuejs/vue-loader@3c02f26...653d8f8)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)

---

### [`v15.0.5`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1506httpsgithubcomvuejsvue-loadercomparev1505v1506-2018-05-02)
[Compare Source](vuejs/vue-loader@998a573...3c02f26)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)

---

### [`v15.0.4`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1505httpsgithubcomvuejsvue-loadercomparev1504v1505-2018-04-30)
[Compare Source](vuejs/vue-loader@36d18e4...998a573)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)

---

### [`v15.0.3`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1504httpsgithubcomvuejsvue-loadercomparev1503v1504-2018-04-27)
[Compare Source](vuejs/vue-loader@d192945...36d18e4)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))

---

### [`v15.0.2`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1503httpsgithubcomvuejsvue-loadercomparev1502v1503-2018-04-26)
[Compare Source](vuejs/vue-loader@ee4d8ab...d192945)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))

---

### [`v15.0.1`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1510httpsgithubcomvuejsvue-loadercomparev15012v1510-2018-05-19)
[Compare Source](vuejs/vue-loader@v15.0.0...ee4d8ab)
##### Performance Improvements

* avoid duplicate linting when used with eslint-loader ([3d07f81](vuejs/vue-loader@3d07f81))
#### [15.0.12](vuejs/vue-loader@v15.0.11...v15.0.12) (2018-05-18)
##### Bug Fixes

* ignore attrs that might interfere with query generation ([3a37269](vuejs/vue-loader@3a37269)), closes [vuejs/vue-cli#&#8203;1324](`https://github.com/vuejs/vue-cli/issues/1324`)
#### [15.0.11](vuejs/vue-loader@v15.0.9...v15.0.11) (2018-05-15)
##### Bug Fixes

* improve HMR reliability ([4ccd96f](vuejs/vue-loader@4ccd96f))
#### [15.0.10](vuejs/vue-loader@v15.0.9...v15.0.10) (2018-05-11)
##### Bug Fixes

* improve HMR reliability ([52012cd](vuejs/vue-loader@52012cd))
#### [15.0.9](vuejs/vue-loader@v15.0.8...v15.0.9) (2018-05-04)
##### Bug Fixes

* shadowMode still has to be an option ([4529f83](vuejs/vue-loader@4529f83))
#### [15.0.8](vuejs/vue-loader@v15.0.7...v15.0.8) (2018-05-04)
##### Bug Fixes

* avoid mutating original rules array ([14bfc01](vuejs/vue-loader@14bfc01)), closes [#&#8203;1286](`https://github.com/vuejs/vue-loader/issues/1286`)
#### [15.0.7](vuejs/vue-loader@v15.0.6...v15.0.7) (2018-05-03)
##### Bug Fixes

* stylePostLoader injection for windows flat node_modules ([a9a4412](vuejs/vue-loader@a9a4412)), closes [#&#8203;1284](`https://github.com/vuejs/vue-loader/issues/1284`)
#### [15.0.6](vuejs/vue-loader@v15.0.5...v15.0.6) (2018-05-02)
##### Bug Fixes

* duplicate loaders when using src import with loader options ([37329e1](vuejs/vue-loader@37329e1)), closes [#&#8203;1278](`https://github.com/vuejs/vue-loader/issues/1278`)
#### [15.0.5](vuejs/vue-loader@v15.0.4...v15.0.5) (2018-04-30)
##### Bug Fixes

* ignore VueLoaderPlugin check when using thread-loader ([#&#8203;1268](`https://github.com/vuejs/vue-loader/issues/1268`)) ([476f466](vuejs/vue-loader@476f466)), closes [#&#8203;1267](`https://github.com/vuejs/vue-loader/issues/1267`)
#### [15.0.4](vuejs/vue-loader@v15.0.3...v15.0.4) (2018-04-27)
##### Bug Fixes

* enable whitelist in exclude function ([5b0e392](vuejs/vue-loader@5b0e392))
#### [15.0.3](vuejs/vue-loader@v15.0.2...v15.0.3) (2018-04-26)
##### Bug Fixes

* handle rule.use being a string (ref: [#&#8203;1256](`https://github.com/vuejs/vue-loader/issues/1256`)) ([fc2ba27](vuejs/vue-loader@fc2ba27))
#### [15.0.2](vuejs/vue-loader@v15.0.1...v15.0.2) (2018-04-26)
##### Bug Fixes

* remove resource field in cloned rules (fix [#&#8203;1254](`https://github.com/vuejs/vue-loader/issues/1254`)) ([35ca03f](vuejs/vue-loader@35ca03f))
#### [15.0.1](vuejs/vue-loader@v15.0.0...v15.0.1) (2018-04-25)
##### Bug Fixes

* prioritize .vue rules in plugin (fix [#&#8203;1246](`https://github.com/vuejs/vue-loader/issues/1246`)) ([bffacd5](vuejs/vue-loader@bffacd5))
* warn missing plugin ([068bb81](vuejs/vue-loader@068bb81))

---

### [`v15.0.0`](https://github.com/vuejs/vue-loader/blob/master/CHANGELOG.md#&#8203;1500httpsgithubcomvuejsvue-loadercomparev1500-rc2v1500-2018-04-24)
[Compare Source](vuejs/vue-loader@6430bc0...v15.0.0)
##### Bug Fixes

* compat with null-loader (close [#&#8203;1239](`https://github.com/vuejs/vue-loader/issues/1239`)) ([5cd5f6f](vuejs/vue-loader@5cd5f6f))
##### Features

* support declaring rules using .vue.html (ref [#&#8203;1238](`https://github.com/vuejs/vue-loader/issues/1238`)) ([a3af6b3](vuejs/vue-loader@a3af6b3))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
@hzm131
Copy link

hzm131 commented Jul 19, 2018

都是大神

@diadal
Copy link

diadal commented Jan 12, 2019

I fund the cause of this issue in /node_modules/vue-loader/lib/plugin.js there is this checking point vueLoaderUseIndex < 0 under const vueUse = vueRule.use I make this following changes

let ListIndex = [];

    const vueLoaderUseIndex = vueUse.findIndex(u => {
      console.log(u)
      let vueChecker =  /^vue-loader|(\/|\\|@)vue-loader/.test(u.loader)

      console.log({u:u.loader})

      ListIndex[u.loader] = vueChecker
      return vueChecker
    })
    console.log({ListIndex:ListIndex['vue-loader']})

in my terminal I have this

{ ListIndex: [ 'vue-loader': true ] }
{ ListIndex: [ 'html-loader': false ] }

this show to rules are been fire when I npm run dev and this html-loader is not defined in my web pack config file so vueLoaderUseIndex < 0 stop the processing since 'html-loader': false

am currently working on the solution or if there is fast fix for this please share

@diadal
Copy link

diadal commented Jan 12, 2019

am able to bypass the error by doing this but I dont know if it right thing to do


const vueLoaderUseIndex = vueUse.findIndex(u => {
      let vueChecker =  /^vue-loader|(\/|\\|@)vue-loader/.test(u.loader)
                       || /^babel-loader|(\/|\\|@)babel-loader/.test(u.loader)
                       || /^html-loader|(\/|\\|@)html-loader/.test(u.loader)
                       || /^file-loader|(\/|\\|@)file-loader/.test(u.loader)
                       || /^img-loader|(\/|\\|@)img-loader/.test(u.loader)
      return vueChecker
    })

@peterabarry
Copy link

peterabarry commented Mar 23, 2019

I do not believe this is fixed. I see the same behavior as @diadal in that the array of rules is processed as 1 item arrays one at a time, so always fails on the non-vue rules. So some guidance on usage is desired if that is expected as it implies no other rules can be used in presence of Vue Plugin.

I wonder though if this is only in the context of storybook loading of the webpack config incorrectly. Will investigate

@ArnolFokam
Copy link

ArnolFokam commented Feb 3, 2020

I just encountered the same error on vue-loader 15.8.3. While inspecting the source for my webpack version at plugin-webpack4.js

let vueRuleIndex = rawRules.findIndex(createMatcher(`foo.vue`))

I came to the conclusion that the matcher created for foo.vue allows a rule for html-loader to pass the test for some reasons I don't know. I was able to get it work by replace the line55 of the piece of code below with @diadal's comment #1238 (comment)
const vueLoaderUseIndex = vueUse.findIndex(u => {
return /^vue-loader|(\/|\\|@)vue-loader/.test(u.loader)
})

But I don't think this can be a decent solution to this issue.

@fathimamusnamuharis
Copy link

actually to me npm update corrected the error

@nsxr51
Copy link

nsxr51 commented Feb 27, 2020

also to me just npm update

@zachgilbert97
Copy link

For me the fix was to move the rule in my config to the top of the array of rules. Can't tell you why, but it did the trick!

  • Webpack v5.52.0
  • webpack-dev-server 4.1.0
  • yarn v11.22.11

In my webpack.common.js:

const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
    entry: {
        main  : "./src/main.js",
        vendor: "./src/vendor.js",
    },

    module: {
        rules: [

            // Moved this to the top of all rules
            {
                test  : /\.vue$/,
                loader: "vue-loader",
            },

            {
                test: /\.html$/,
                use : ["html-loader"],
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                }
            },
            {
                test: /\.(svg|png|jpe?g|gif)$/,
                use : {
                    loader : "file-loader",
                    options: {
                        name      : "[name].[contentHash:8].[ext]",
                        outputPath: "assets/img",
                        esModule  : false,
                    },
                },
            },
        ],
    },

    plugins: [
        new VueLoaderPlugin(),
    ],
}

And my webpack.dev.js (just for reference since i'm using configs for different enviornments):

const autoprefixer = require("autoprefixer")
const common       = require("./webpack.common")
const { merge }    = require("webpack-merge")
const path         = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = merge(common, {
    mode   : "development",
    devtool: "source-map",

    output: {
        filename: "[name].bundle.js",
        path    : path.resolve(__dirname, "dist", "index.html"),
    },

    module: {
        rules: [
            {
                test: /\.scss$/,
                use : [
                    "style-loader",
                    "css-loader",
                    {
                        loader: "postcss-loader",
                        options: {
                            plugins: () => [autoprefixer()],
                        },
                    },
                    "sass-loader",
                ],
            },
        ],
    },

    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/template.html"
        }),
    ],
})

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