Home > Web Front-end > Vue.js > How to add less dependency to vue scaffolding

How to add less dependency to vue scaffolding

青灯夜游
Release: 2021-10-27 16:42:53
Original
2858 people have browsed it

Adding method: 1. Use the "npm install less less-loader --save" command to install less dependencies; 2. Modify the "webpack.base.conf.js" file and configure the loader to load dependencies so that it supports External less is enough.

How to add less dependency to vue scaffolding

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

How to add less dependencies on vue scaffolding:

1. Install less dependencies

npm install less less-loader --save
Copy after login

2. Modify webpack .base.conf.js file, configure the loader to load dependencies so that it supports external less, add

{
  test: /\.less$/,
  loader: 'style-loader!css-loader!less-loader'
},
Copy after login

to the model. Note:

Possible errors: TypeError: loaderContext.getResolve is not a function

This is because the version of less-loader is too high. Uninstall it and re-download a lower version. Less will also be uninstalled and installed the lower version.

Related recommendations: "vue.js Tutorial"

The above is the detailed content of How to add less dependency to vue scaffolding. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
vue
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template