Vue-loader: Cannot find module 'webpack/lib/RuleSet'

Created on 13 Nov 2018  路  17Comments  路  Source: vuejs/vue-loader

Version

15.4.0

Reproduction link

https://www.npmjs.com/package/vue-loader/v/15.4.2

Steps to reproduce

Init a project without installing webpack locally , and run global webpack in terminal

What is expected?

webpack build successfully

What is actually happening?

Error: Cannot find module 'webpack/lib/RuleSet'


Due to line 2 in node_modules/vue-loader/lib/plugin.js

const RuleSet = require('webpack/lib/RuleSet')

Most helpful comment

This happens with the next version of Webpack (Webpack 5.0.0-rc.1)

All 17 comments

i have the same error, however const RuleSet = require('webpack/lib/RuleSet') is exists in plugin.js file

any ways to solve?

@935839596 webpack already added as a peer dependency in the latest version. Now there should be a warning if you didn鈥檛 manually install webpack alongside vue-loader.

I had to add the following to webpack.config.js to get around this error:

var webpack = require('webpack');

add webpack package to ur package.json, cause vue-loader is based on it

Any updates?

I'm also having this problem, none of the above suggestions work

Check this https://github.com/vuejs/vue-loader/issues/1586#issuecomment-528682809
Adding webpack as a dev dependency resolved the issue for me.

This happens with the next version of Webpack (Webpack 5.0.0-rc.1)

Check this #1586 (comment)
Adding webpack as a dev dependency resolved the issue for me.

tried doing this, still no luck.
Require stack:
image

*btw, I'm using nuxt and trying to configure nuxt-highcharts

Check this #1586 (comment)
Adding webpack as a dev dependency resolved the issue for me.

tried doing this, still no luck.
Require stack:
image

*btw, I'm using nuxt and trying to configure nuxt-highcharts

I have the same problem, any ways to solve? :(

It has to be webpack ^4.0.0 as the file was removed in v5.

https://github.com/webpack/webpack/commit/74d4669d738a0f4e1587416cbc64839736eff39a#diff-f953e9f47b1aa87d20fc094ba839f3b5c5e145cf963ba0c151185bd3f344cdd3

It has to be webpack ^4.0.0 as the file was removed in v5.

"has to"... well, if we have packages that depends on webpack5, we can't really ask them to use a downgraded version though

Both v15 & v16 have already added support for webpack 5. So if you still encounter this issue, please open a new issue with a minimal reproduction.

FYI, this was the only relevant search result when I also encountered the error you mentioned @hieutranminh in a Nuxt project. So in case anyone else out there is also trying to use Webpack 5 with Nuxt, it's a matter of @nuxt/components not yet supporting webpack5, and we can move that discussion over there: https://github.com/nuxt/components/issues/105

Oh yes, sorry, I only added my comment to help those getting dropped off from search engines.

Check this #1586 (comment)
Adding webpack as a dev dependency resolved the issue for me.

this solved my problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisvfritz picture chrisvfritz  路  4Comments

C0deZLee picture C0deZLee  路  3Comments

amorphine picture amorphine  路  3Comments

snoopdouglas picture snoopdouglas  路  3Comments

sdvcrx picture sdvcrx  路  3Comments