Home  >  Article  >  Web Front-end  >  How to add less dependency to vue scaffolding

How to add less dependency to vue scaffolding

青灯夜游
青灯夜游Original
2021-10-27 16:41:202802browse

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

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'
},

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!

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