Vue-cli3 global variables into less of

Combined with online and many ineffective methods, are summarized as follows

Note that the installation vue, not npm! ! !

vue add style-resources-loader

Selected during installation less

Modify the root vue.config.js of patternsparameters

const path = require("path");

module.exports = {
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [path.resolve(__dirname, "src/global.less")]
    }
  }
};
Released 1392 original articles · won praise 347 · Views 1.23 million +

Guess you like

Origin blog.csdn.net/mouday/article/details/103904642