This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
forked from beeequeue/yuna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
101 lines (87 loc) · 2.63 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
/* eslint-disable no-console */
const { platform } = require('os')
const { resolve } = require('path')
const { spawnSync } = require('child_process')
const SentryCliPlugin = require('@sentry/webpack-plugin')
const GIT_TAG = spawnSync('git', ['tag', '-l', '--points-at', 'HEAD'])
.output.filter(b => b && b.length > 0)
.map(buffer => buffer.toString().trim())[0]
console.log(`GIT_TAG=${GIT_TAG}`)
console.log(`NODE_ENV=${process.env.NODE_ENV}`)
/**
* @type { ProjectOptions }
*/
module.exports = {
css: {
sourceMap: true,
},
configureWebpack: config => {
config.target = 'electron-renderer'
if (process.env.NODE_ENV === 'development') {
config.devtool = 'eval-source-map'
config.output.devtoolModuleFilenameTemplate = info =>
info.resourcePath.match(/\.vue$/) &&
!info.identifier.match(/type=script/) // this is change ✨
? `webpack-generated:///${info.resourcePath}?${info.hash}`
: `webpack:///${info.resourcePath}`
config.output.devtoolFallbackModuleFilenameTemplate =
'webpack:///[resource-path]?[hash]'
}
},
lintOnSave: false,
/**
* @param config { import("webpack-chain").Config }
*/
chainWebpack: config => {
// prettier-ignore
config.output
.filename('js/[name].js')
.chunkFilename('js/[name].js')
config.resolve.extensions.add('.node')
const svgRules = config.module.rule('svg')
svgRules.uses.clear()
svgRules.use('raw-loader').loader('raw-loader')
config.module
.rule('native')
.test(/\.node$/)
.use('node-loader')
.loader('node-loader')
// Define
config.plugin('define').tap(([args]) => {
const options = { ...args }
options['process.env'].FLUENTFFMPEG_COV = false
if (process.env.NODE_ENV === 'development') {
options['process.env'].DEV_BASE_PATH = JSON.stringify(__dirname)
}
return [options]
})
// Sentry Source Maps
config.when(
process.env.CI &&
platform() === 'linux' &&
process.env.NODE_ENV === 'production' &&
GIT_TAG != null,
config => {
config
.plugin('sentry')
.use(SentryCliPlugin, [
{
release: GIT_TAG,
include: resolve(__dirname, 'dist_electron', 'bundled'),
ignore: ['node_modules', 'css'],
urlPrefix: 'app://./',
},
])
.after('fork-ts-checker')
},
)
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
chainWebpackMainProcess: config => {
config.resolve.alias.set('@', resolve(__dirname, 'src'))
},
},
},
}