D. Yabon
D. Yabon

Reputation: 31

Cannot find module 'mini-css-extract-plugin' in vue.js

I'm having problems with npm run dev. It keeps on telling me that module webpack-cli/bin/config-yargs cannot be found. Modules added like webpack, webpack-cli, and webpack-dev-server are on their latest versions. Anyone who also experienced same issue?

I already tried reinstalling the modules stated above and looked around github and stack forums for solution and none of them worked for me

package.json:

scripts: {
    "dev": "webpack-dev-server --inline --progress --config 
            build/webpack.dev.conf.js",
    "start": "npm run dev",
    "unit": "jest --config test/unit/jest.conf.js --coverage",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
    "build": "node build/build.js"
},
devDependencies: {
    "webpack": "^4.28.2",
    "webpack-bundle-analyzer": "^3.0.3",
    "webpack-cli": "^3.1.2",
    "webpack-dev-server": "^3.1.13",
    "webpack-merge": "^4.1.0",
    "mini-css-extract-plugin": "^0.5.0"
}

Modules are already installed and it should start running instead of throwing

Cannot find module 'webpack-cli/bin/config-yargs'


UPDATE 12/26/2018

webpack v4 doesn't support extract-text-webpack-plugin so I replaced it with mini-css-extract-plugin and now it shows this result

Cannot find module 'mini-css-extract-plugin'

Upvotes: 2

Views: 3592

Answers (1)

D. Yabon
D. Yabon

Reputation: 31

FINALLY

So I created a new project and added mini-css-extract-plugin in devDependencies and updated webpack.dev.conf.js with

const MiniCssExtractPlugin = require('mini-css-extract-plugin')

since extract-text-webpack-plugin is deprecated when using webpack v4 and now it works!

Upvotes: 1

Related Questions