Home >Web Front-end >JS Tutorial >Solve the loader problem of projects created by vue-cli

Solve the loader problem of projects created by vue-cli

亚连
亚连Original
2018-05-30 16:04:591419browse

Below I will share with you an article that solves the loader problem of vue-cli creation project. It has a good reference value and I hope it will be helpful to everyone.

When using the vue-cli project to create a project, when using pre-compiled css languages ​​such as sass, you do not need to configure it in the config, you only need to install the corresponding loader in the project.

For example:

1. Use sass in the project

$ npm i node-sass -D
$ npm i sass-loader -D

2. When using vuex, even if vux and vux-loader are installed and vux components are used in the project, the project will not start and the error will be as follows:

These dependencies were not found:

* !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../../../vue-loader/lib/style-compiler/index?{"vue":true,"id":"da
ta-v-28d8bf8a","scoped":false,"hasInlineConfig":false}!../../../../vux-loader/src/after-less-loader.js!less-loader?{"sourceMap":false}!..
/../../../vux-loader/src/style-loader.js!../../../../vue-loader/lib/selector?type=styles&index=0!./index.vue in ./~/vux/src/components/ce
ll/index.vue
* !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../../../vue-loader/lib/style-compiler/index?{"vue":true,"id":"da
ta-v-76475f48","scoped":false,"hasInlineConfig":false}!../../../../vux-loader/src/after-less-loader.js!less-loader?{"sourceMap":false}!..
/../../../vux-loader/src/style-loader.js!../../../../vue-loader/lib/selector?type=styles&index=0!./index.vue in ./~/vux/src/components/gr
oup/index.vue

To install them, you can run: npm install --save !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../../../vue-loade
r/lib/style-compiler/index?{"vue":true,"id":"data-v-28d8bf8a","scoped":false,"hasInlineConfig":false}!../../../../vux-loader/src/after-le
ss-loader.js!less-loader?{"sourceMap":false}!../../../../vux-loader/src/style-loader.js!../../../../vue-loader/lib/selector?type=styles&i
ndex=0!./index.vue !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../../../vue-loader/lib/style-compiler/index?{"v
ue":true,"id":"data-v-76475f48","scoped":false,"hasInlineConfig":false}!../../../../vux-loader/src/after-less-loader.js!less-loader?{"sou
rceMap":false}!../../../../vux-loader/src/style-loader.js!../../../../vue-loader/lib/selector?type=styles&index=0!./index.vue
> Listening at http://localhost:8080

At a glance, I can confirm that there is a problem with the loader, but I have installed the dependencies for sass compilation and still cannot solve the error.

Later I checked the vux package and found that the component used less, so I installed the less dependency to solve the problem.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Angular study notes: examples of integrating third-party UI frameworks and controls

Node.js implementation registration Example of how to activate the email function

Detailed explanation of Webpack’s babel-loader file preprocessor

The above is the detailed content of Solve the loader problem of projects created by vue-cli. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn