-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathvue.config.js
116 lines (111 loc) · 3.21 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const path = require('path');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
// eslint-disable-next-line camelcase
const { npm_package_version } = process.env;
const commitHash = require('child_process')
.execSync('git rev-parse HEAD')
.toString().trim();
module.exports = {
lintOnSave: false,
css: {
loaderOptions: {
sass: {
// Global includes - will be prepended in every scss file (including components)
additionalData: `
@import "${path.resolve(__dirname, 'src/styles/variables.scss')}";
@import "${path.resolve(__dirname, 'src/styles/mixins.scss')}";
`,
},
},
},
chainWebpack: (config) => {
config
.plugin('favicons')
.use(FaviconsWebpackPlugin, [{
logo: path.resolve(__dirname, 'src/assets/favicon.svg'),
inject: 'force',
favicons: {
start_url: '/',
appName: 'Superhero',
appDescription: 'Social platform with a mission',
developerName: 'Aeternity Developers',
developerURL: 'https://github.com/aeternity/superhero-ui',
background: '#1c1c24',
theme_color: '#1c1c24',
icons: {
firefox: { offset: 15 },
},
},
}])
.end()
.plugin('define')
.tap((options) => {
const definitions = { ...options[0] };
// eslint-disable-next-line camelcase
if (npm_package_version) {
definitions['process.env.npm_package_version'] = JSON.stringify(npm_package_version);
}
definitions['process.env.COMMIT_HASH'] = JSON.stringify(commitHash);
definitions['process.env.VUE_CLI_SSR'] = JSON.stringify(process.env.UVUE_SIDE === 'server');
return [definitions];
})
.end()
.resolve.alias
.delete('@')
.set('core-js-pure', 'core-js')
.set('lodash', 'lodash-es')
.set('js-yaml', 'empty-module')
.parent.parent
.module
.rule('aes')
.test(/\.aes$/)
.use('raw-loader')
.loader('raw-loader')
.end();
config.module.rule('svg')
.uses.clear().end()
.oneOf('icon-component')
.resourceQuery(/icon-component/)
.use('babel-loader')
.loader('babel-loader')
.options({ configFile: false, presets: ['@babel/preset-env'] })
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [{
addClassesToSVGElement: {
type: 'full',
fn(data, options, extra) {
const svg = data.content[0];
svg.class.add('icon', path.basename(extra.path, '.svg'));
return data;
},
},
}],
},
})
.end()
.end()
.oneOf('skip-optimize')
.resourceQuery(/skip-optimize/)
.use('svg-url-loader')
.loader('svg-url-loader')
.end()
.end()
.oneOf('default')
.use('svg-url-loader')
.loader('svg-url-loader')
.options({
noquotes: true,
limit: 4096,
name: 'img/[name].[hash:8].[ext]',
})
.end()
.use('svgo-loader')
.loader('svgo-loader')
.end();
return config;
},
};