-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
vue.config.js
106 lines (96 loc) · 2.65 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
const path = require('path');
const RobotstxtPlugin = require("robotstxt-webpack-plugin");
const paths = {
src: path.resolve(path.join(__dirname, 'src')),
dist: path.resolve(path.join(__dirname, 'dist')),
}
// see https://github.com/itgalaxy/generate-robotstxt
const robotstxtPluginOptions = {
policy: [
process.env.VUE_APP_MODE === 'production' ? {
userAgent: "*",
disallow: "/embed.html",
} : {
userAgent: "*",
disallow: "/",
}
],
}
if (process.env.NODE_ENV != 'production') {
process.env.VUE_APP_TITLE = process.env.VUE_APP_TITLE + ' (preview)'
process.env.VUE_APP_DESC = process.env.VUE_APP_DESC + ' (preview)'
}
indexTemplate = process.env.CADDY_BUILD == '1' ? 'index_caddy.html' : 'index.html'
console.log("Using template", indexTemplate)
module.exports = {
productionSourceMap: process.env.NODE_ENV != 'production',
publicPath: process.env.C19_PUBLIC_PATH || '/',
outputDir: process.env.C19_OUTPUT_DIR || 'dist',
filenameHashing: true,
devServer: {
disableHostCheck: true,
},
pages: {
index: {
entry: ['src/index.js'],
template: indexTemplate,
filename: 'index.html',
},
embed: {
entry: ['src/embed.js'],
template: indexTemplate,
filename: 'embed.html',
},
},
css: {
loaderOptions: {
scss: {
prependData: '@import "@/../src/style/bootstrap.scss";'
},
sass: {
prependData: '@import "@/../src/style/bootstrap.scss"'
},
}
},
pluginOptions: {
webpackBundleAnalyzer: {
analyzerMode: process.env.DISPLAY ? 'server' : 'disabled',
openAnalyzer: process.env.DISPLAY ? true : false,
},
},
// configureWebpack: {
// plugins: [
// new RobotstxtPlugin(robotstxtPluginOptions)
// ]
// },
chainWebpack: config => {
config.output.filename('[name].[hash:8].js')
config.output.chunkFilename('[name].[hash:8].js')
if (config.plugins.has('prefetch-index')) {
config.plugin('prefetch-index').tap(options => {
options[0].fileBlacklist = options.fileBlacklist || [];
options[0].fileBlacklist.push(/.*\.route\./);
return options;
});
}
config.plugin('robotstxt').use(RobotstxtPlugin, [robotstxtPluginOptions])
// Markdown Loader
config.module
.rule('md')
.test(/\.md$/)
.use('html-loader')
.loader('html-loader')
.end()
.use('markdown-loader')
.loader('markdown-loader')
.end()
// Fable loader
config.module
.rule('fable')
.test(/\.fs(x|proj)?$/)
.use('fable-loader')
.loader('fable-loader')
.end()
config.resolve.modules.prepend(paths.src)
}
}