forked from lutece-awesome/lutece-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
90 lines (86 loc) · 2.26 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
const _ = require('lodash');
const FontminPlugin = require('fontmin-webpack');
const PurgecssPlugin = require('purgecss-webpack-plugin');
const path = require('path');
const glob = require('glob-all');
class MyFontminPlugin extends FontminPlugin {
findFontFiles(compilation) {
const regular = this.findRegularFontFiles(compilation);
const extract = this.findExtractTextFontFiles(compilation);
return _.filter(
_.uniqBy(regular.concat(extract), 'asset'),
o => !o.asset.includes('KaTeX'),
);
}
apply(compiler) {
compiler.hooks.compilation.tap('Fontmin', (compilation) => {
compilation.hooks.additionalAssets.tap('Fontmin', () => {
this.onAdditionalAssets(compilation, () => {});
});
});
}
}
module.exports = {
pwa: {
name: 'Lutece',
manifestPath: 'static/icons/manifest.json',
iconPaths: {
favicon32: 'static/icons/favicon-32x32.png',
favicon16: 'static/icons/favicon-16x16.png',
appleTouchIcon: 'static/icons/apple-touch-icon-152x152.png',
maskIcon: 'static/icons/safari-pinned-tab.svg',
msTileImage: 'static/icons/msapplication-icon-144x144.png',
},
themeColor: '#1E88E5',
msTileColor: '#2B5797',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black',
workboxOptions: {
swDest: 'static/js/service-worker.js',
importsDirectory: 'static/js/',
},
},
baseUrl: undefined,
outputDir: undefined,
assetsDir: 'static',
runtimeCompiler: undefined,
productionSourceMap: undefined,
parallel: undefined,
css: undefined,
chainWebpack: (_config) => {
_config.module
.rule('md')
.test(/\.md$/)
.use('raw-loader')
.loader('raw-loader')
.end();
_config.when(process.env.NODE_ENV === 'production', (config) => {
config.plugins
.delete('prefetch')
.end()
.plugin('purgecss')
.use(PurgecssPlugin, [
{
paths: glob.sync([
path.join(__dirname, './index.html'),
path.join(__dirname, './src/**/*.vue'),
path.join(__dirname, './src/**/*.js'),
path.join(
__dirname,
'node_modules',
'vuetify',
'src',
'**/*.@(js|ts)',
),
]),
whitelistPatterns: [/^(?!mdi)/, /^mdi-alpha-./],
},
])
.after('extract-css')
.end()
.plugin('fontmin')
.use(MyFontminPlugin)
.end();
});
},
};