Skip to content

[15.0.0-beta.2] VueLoaderPlugin Error: no matching rule for vue files are found. #1202

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

Closed
sqal opened this issue Mar 23, 2018 · 7 comments
Closed

Comments

@sqal
Copy link

sqal commented Mar 23, 2018

Version

15.0.0-beta.2

Reproduction link

n/a

Steps to reproduce

I noticed that i am getting this error when rule for .vue files contains include option with absolute folder path. Example of failing webpack config

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

const src = path.resolve(__dirname, 'src');

module.exports = {
  entry: {
    app: path.join(src, 'index.js'),
  },
  output: {
    publicPath: '/',
    path: path.resolve(__dirname, 'build'),
    filename: '[name].bundle.js',
    chunkFilename: '[id].[name].chunk.js',
  },
  resolve: {
    extensions: [
      '.js',
      '.vue',
    ],
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        include: src,
        loader: 'babel-loader',
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        include: src, // <-- causes the error
        options: {
          preserveWhitespace: false,
        },
      },
    ],
  },
  plugins: [
    new VueLoaderPlugin(),
  ],
};

Full log:

Error: VueLoaderPlugin Error: no matching rule for vue files are found.
    at VueLoaderPlugin.apply (C:\dev\vue-loader-next\node_modules\vue-loader\lib\plugin.js:19:13)
    at Compiler.apply (C:\dev\vue-loader-next\node_modules\tapable\lib\Tapable.js:375:16)
    at webpack (C:\dev\vue-loader-next\node_modules\webpack\lib\webpack.js:33:19)
    at processOptions (C:\dev\vue-loader-next\node_modules\webpack\bin\webpack.js:335:15)
    at yargs.parse (C:\dev\vue-loader-next\node_modules\webpack\bin\webpack.js:397:2)
    at Object.Yargs.self.parse (C:\dev\vue-loader-next\node_modules\yargs\yargs.js:533:18)
    at Object.<anonymous> (C:\dev\vue-loader-next\node_modules\webpack\bin\webpack.js:152:7)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Function.Module.runMain (module.js:703:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:665:3

Webpack version 3.11.0

What is expected?

I would like to bundle my project without error.

What is actually happening?

Webpack throws mentioned error

@sqal
Copy link
Author

sqal commented Mar 23, 2018

Sorry for duplicate #1201 :(

@loilo
Copy link

loilo commented Mar 23, 2018

That was a quick sequence of issues. 😁

@yyx990803
Copy link
Member

fixed in 2be5507

@Heartnett
Copy link

@yyx990803 Please document the use of VueLoaderPlugin

@loilo
Copy link

loilo commented Apr 25, 2018

@Heartnett Are you looking for the vue-loader docs?

@Heartnett
Copy link

Thanks!

@zhangshengpeng
Copy link

zhangshengpeng commented Nov 20, 2020

I got the same error message when I try to move the 'vue-loader' to oneOf:

rules: [ { oneOf: [ { test: /\.vue$/, include: path.resolve(__dirname, 'src'), loader: 'vue-loader' } ] } ]

error message :
Error: [VueLoaderPlugin Error] No matching rule for .vue files found.
Make sure there is at least one root-level rule that matches .vue or .vue.html files.

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

5 participants