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

Cannot find module 'webpack/lib/RuleSet' #1586

Closed
Sebi2020 opened this issue Sep 5, 2019 · 6 comments
Closed

Cannot find module 'webpack/lib/RuleSet' #1586

Sebi2020 opened this issue Sep 5, 2019 · 6 comments

Comments

@Sebi2020
Copy link

Sebi2020 commented Sep 5, 2019

Version

15.7.1

Steps to reproduce

  1. Install webpack globally

  2. Install vue-loader locally (webpack does not respect global vue-loader installs)

  3. Create a webpack.js.config like this:

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
	entry: './main.js',
	mode: 'development',
	module: {
		rules: [
			{
			test: /\.vue$/,
			loader: 'vue-loader'
			}
		]
	},
	plugins: [
		new VueLoaderPlugin()
	]
}
  1. Create an entry point (main.js in code snippet)
  2. Run npx webpack

What is expected?

Correct module imports

What is actually happening?

Wrong import paths are used

Cannot find module 'webpack/lib/RuleSet

@haoqunjiang
Copy link
Member

A local webpack package is required. It's listed in the package.json:

vue-loader/package.json

Lines 35 to 38 in d3fa467

"peerDependencies": {
"css-loader": "*",
"webpack": "^4.1.0 || ^5.0.0-0"
},

@Sebi2020
Copy link
Author

@sodatea Shouldn't it be added as a proper dependency when it's a required dependency for vue-loader?

@haoqunjiang
Copy link
Member

Peer dependency is a proper type of dependency.
Webpack plugin/loader is the exact intended use case for the peer dependency semantic.
See https://nodejs.org/es/blog/npm/peer-dependencies/

@IBICF
Copy link

IBICF commented May 18, 2021

i solved it by install vue-loader@15.9.7
const VueLoaderPlugin = require('vue-loader/lib/plugin-webpack5');

@wheatup
Copy link

wheatup commented Apr 24, 2023

Running this solves my problem

npm i webpack@4 -D

It installs

"webpack": "^4.46.0"

@GAS0968
Copy link

GAS0968 commented Nov 7, 2023

Running this solves my problem

npm i webpack@4 -D

It installs

"webpack": "^4.46.0"

i solve my same problem in your way,thanks

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