-
Notifications
You must be signed in to change notification settings - Fork 4
/
vue.config.js
54 lines (52 loc) · 1.52 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
const path = require('path');
const appConfig = require('./src/app.config');
const HtmlCriticalWebpackPlugin = require('html-critical-webpack-plugin');
module.exports = {
configureWebpack: {
// We provide the app's title in Webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: appConfig.title,
// Set up all the aliases we use in our app.
resolve: {
alias: require('./aliases.config').webpack,
},
devtool: 'source-map',
plugins: [],
},
productionSourceMap: false,
// Configure Webpack's dev server.
// https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md
devServer: {
...(process.env.API_BASE_URL
? // Proxy API endpoints to the production base URL.
{ proxy: { '/api': { target: process.env.API_BASE_URL } } }
: // Proxy API endpoints a local mock API.
{ before: require('./tests/mock-api') }),
},
css: {
sourceMap: true,
},
pwa: {
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: 'dev/service-worker.js',
},
},
};
if (process.env.NODE_ENV === 'production') {
module.exports.configureWebpack.plugins.push(
new HtmlCriticalWebpackPlugin({
base: path.join(path.resolve(__dirname), 'dist'),
css: path.join(path.resolve(__dirname), 'dev', 'critical.css'),
src: 'index.html',
dest: 'index.html',
inline: true,
minify: true,
width: 1300,
height: 900,
penthouse: {
blockJSRequests: false,
},
})
);
}