-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
62 lines (54 loc) · 1.47 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
/**
* @summary config of vue cli services and it's webpack
* @author Dominik Haas-Artho
*
* Created at : 2020-09-01 11:27:52
* Last modified : 2020-09-02 17:15:40
*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.txt', which is part of this source code package.
*/
/* eslint-disable no-console */
const fs = require('fs');
const dotenv = require('dotenv');
dotenv.config();
process.env.VUE_APP_VERSION = require('./package.json').version;
const version = process.env.VUE_APP_VERSION;
const useTestData = !!(
process.env.VUE_APP_USE_TESTDATA &&
process.env.VUE_APP_USE_TESTDATA === 'true'
);
const isProd = process.env.NODE_ENV === 'production';
if (isProd) {
const fileName = `version_${version}.txt`;
const filePath = `${__dirname}/public/${fileName}`;
fs.writeFile(filePath, version, (err) => {
if (err) {
return console.log(`Tried to created file ${fileName}. Error: ${err}`);
}
return console.log(
`Created version file ${fileName} for easy build version highlight.`,
);
});
}
console.log(
`starting ${version} with use of testdata '${useTestData}' on ${process.env.NODE_ENV}`,
);
module.exports = {
transpileDependencies: ['vuetify'],
publicPath: './',
assetsDir: './static',
runtimeCompiler: true,
css: {
sourceMap: true,
},
configureWebpack: {
devtool: 'source-map',
optimization: {
splitChunks: {
minSize: 10000,
maxSize: 250000,
},
},
},
};