-
Notifications
You must be signed in to change notification settings - Fork 67
/
vue.config.js
59 lines (55 loc) · 1.62 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
const path = require('path')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const PrerenderSPAPlugin = require('prerender-spa-plugin')
const routes = require('./src/routes')
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
module.exports = {
publicPath: '/',
devServer: {
port: 3000,
disableHostCheck: true
},
configureWebpack: config => {
config.plugins.push(new MonacoWebpackPlugin({
languages: ['javascript']
}))
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader'
})
process.env.NODE_ENV === 'production' &&
config.plugins.push(
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, 'dist'),
routes: routes.all().map(route => route.path),
renderer: new Renderer({
renderAfterDocumentEvent: 'x-app-rendered',
maxConcurrentRoutes: 4,
headless: true // If false, display the browser window when rendering. Useful for debugging
}),
postProcess (renderedRoute) {
// ignore redirects
renderedRoute.route = renderedRoute.originalRoute
return renderedRoute
}
})
)
},
chainWebpack: config => {
config.module.rule('eslint').use('eslint-loader')
.tap(opts => ({
...opts,
failOnError: process.env.NODE_ENV === 'production'
}))
},
pluginOptions: {
sitemap: {
baseURL: 'https://proto.school',
urls: routes.all()
.filter(route => !!route.sitemap)
.map(route => route.sitemap),
outputDir: 'public',
trailingSlash: true
}
}
}