-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
npm run build error No module factory available for dependency type: CssDependency #5030
Comments
What's the project? |
Thanks for looking! I have uploaded the exact same code that I used when filling out the issue: |
It's unbelievable. I just cloned and built using the above library, and this time it worked without any problems. |
I guess it's related to the shell or file system… |
I am a bit late for this issue and this is really not related to Vue CLI. For me the issue was that I did not have the MiniCssExtractPlugin listed in the webpack configs' plugins section, but used it's loader in the rules section. |
Than you @letscodehu . It helped me! |
I only found success with v0.8.0 of mini-css-extract-plugin, when used with vue-cli-service (v0.9.0, v0.8.2, and v0.8.1 resulted in the same CssDependency error message). I pinned the version via the following package.json entry:
|
According to this answer https://stackoverflow.com/a/59618639/32429 it is related to the upper/lower case of the path used when The footer in the Vue UI shows the path all in lowercase, but the real path has uppercase letters in it. |
Renaming the folders to be all in lowercase letters resolved the problem for me. (On Windows 10.) |
Can you explain a little more the files and where did you change this? |
@CabuxaMapache Sure! I faced this issue with a simple webpack build, the relevant part of the config: // required the mini-css plugin
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [], // the plugin section missed the 'new MiniCssExtractPlugin()'
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'], // used the loader here
},
],
},
}; I know that github issues is not stackoverflow, but when searched for the issue this was one of the first result, therefore I included my solution for this even though its not vue-cli. |
I happened to get this thread that fixed my issue by adding the webpack plugin instance. Hope this could work for you. webpack-contrib/mini-css-extract-plugin#493 (comment) |
If you use webpack-merge to merge the cooperation, MiniCssExtractPlugin is used in the loader, but the MiniCssExtractPlugin is not used in the same file as MiniCssExtractPlugin, the error will occur,!!! You need to be in the same file Use MiniCssExtractPlugin in both the loader and plugin. |
Thank you! This worked perfectly for me! One letter was off. Man that's frustrating lol. |
I had same problem and this answer was the solution for my fix. |
Version
4.1.2
Environment info
Steps to reproduce
PS E:\Games > cd hitokoto
PS E:\Games\hitokoto > npm run build
What is expected?
npm run build succeeded
What is actually happening?
Total task duration: 9.96s
I'm not sure why vue info says "@vue/cli: Not Found" when it clearly is installed. Before opening this issue I ran npm uninstall -g @vue/cli and npm install -g @vue/cli.
and i running vue-cli-service build,The system throws this error:No module factory available for dependency type: CssDependency
The text was updated successfully, but these errors were encountered: