-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
74 lines (63 loc) · 2.04 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const path = require("path");
const SVGSymbolSprite = require("svg-symbol-sprite-loader");
const ESLintPlugin = require("eslint-webpack-plugin");
const StyleLintPlugin = require("stylelint-webpack-plugin");
// Define the resolve method to obtain the absolute path of the file
const resolve = dir => path.join(__dirname, dir);
module.exports = {
// The base URL your application bundle will be deployed at
"publicPath": process.env.NODE_ENV === "production" ? "/vue-users/" : "/",
// Add configuration for use Dart sass/scss and compile files of 'assets' folder
"css": {
"loaderOptions": {
"sass": {
"additionalData": `@use "@/assets/scss/styles.scss" as *;`,
},
},
},
// Emit 'eslint' errors and warnings in the console
// https://cli.vuejs.org/config/#lintonsave
"lintOnSave": true,
// Add configuration for autofix stylelint errors
"configureWebpack": {
"plugins": [
// Add configuration for autofix eslint errors
new ESLintPlugin({
"fix": true,
"files": [
"src/**/*.{vue,js}",
],
}),
// Add configuration for autofix stylelint errors
new StyleLintPlugin({
"fix": true,
"files": [
"src/**/*.{vue,scss}",
],
}),
],
},
// Allows more fine-grained modifications to the internal webpack configuration
"chainWebpack": config => {
// Create and insert sprite before the html body
config.plugin("svg-symbol-sprite-loader").after("html").
use(SVGSymbolSprite.Plugin).
end();
// Configure svg default rules to exclude svg file processing in icons directory
config.module.rule("svg").exclude.add(resolve("src/assets/images/icons/svg")).end();
// New icons rule, set svg sprite loader to process svg files in the 'src/assets/images/icons/svg' folder
config.module.
rule("svg-sprite").
uses.clear().
end().
test(/\.svg$/u).
include.add(resolve("src/assets/images/icons/svg")).
end().
use("svg-symbol-sprite-loader").
loader("svg-symbol-sprite-loader").
options({
"symbolId": filePath => `icon-${path.basename(filePath, ".svg")}`,
}).
end();
},
};