-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
99 lines (94 loc) · 2.61 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
/** Vuetify向けvue設定 */
// eslint-disable-next-line node/no-extraneous-require
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const TerserPlugin = require('terser-webpack-plugin');
// バージョン情報など
const pjson = require('./package.json');
// 現在の時刻(ビルド時刻)
const build = new Date().toISOString();
if (process.env.NODE_ENV === 'production') {
// Meta.tsを書き込む
fs.writeFileSync(
path.resolve(path.join(__dirname, 'src/Meta.ts')),
`import MetaInterface from './interfaces/MetaInterface';
// This file is auto-generated by the build system.
const meta: MetaInterface = {
version: '${pjson.version}',
date: '${build}',
};
export default meta;
`
);
}
/**
* @type {import('@vue/cli-service').ProjectOptions}
*/
module.exports = {
transpileDependencies: ['vuex-persist', 'vuetify'],
lintOnSave: process.env.NODE_ENV !== 'production',
configureWebpack: {
optimization: {
runtimeChunk: 'single',
splitChunks: {
name: 'vendor',
chunks: 'initial',
minSize: 100000,
maxSize: 250000,
},
minimize: process.env.NODE_ENV === 'production',
minimizer: [
new TerserPlugin({
terserOptions: {
ascii_only: true,
compress: { drop_console: true },
mangle: true,
ecma: 2020,
sourceMap: false,
output: { comments: false, beautify: false },
},
}),
],
},
plugins:
process.env.NODE_ENV === 'production'
? [
new webpack.BannerPlugin({
banner: `${pjson.name} v${pjson.version} | ${pjson.author.name}<${pjson.author.email}> ${pjson.author.url} | license: ${pjson.license} | build: ${build}`,
}),
]
: [],
},
pluginOptions: {
i18n: {
localeDir: 'locales',
enableInSFC: true,
},
electronBuilder: {
preload: 'src/preload.ts',
disableMainProcessTypescript: false,
mainProcessTypeChecking: false,
nodeIntegration: true,
chainWebpackRendererProcess: config => {
// Chain webpack config for electron renderer process only
// The following example will set IS_ELECTRON to true in your app
config.plugin('define').tap(args => {
args[0].IS_ELECTRON = true;
return args;
});
},
builderOptions: {
mac: {
icon: 'build/icon.png',
target: 'zip',
},
win: {
icon: 'build/icon.png',
},
},
},
lintStyleOnBuild: true,
stylelint: {},
},
};