forked from CodePilotai/codepilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
90 lines (88 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
const path = require('path')
const webpack = require('webpack')
const aliases = require('./aliases.config').webpack
module.exports = {
chainWebpack(config) {
config.resolve.alias.merge(aliases)
config.plugin('envVars').use(webpack.DefinePlugin, [
{
...require('./env-variables.config').renderer,
'global.GENTLY': false
}
])
config.plugin('monaco-editor').use(require('monaco-editor-webpack-plugin'))
if (process.env.NODE_ENV !== 'production') {
config
.plugin('monaco-editor-hack')
.use(webpack.ContextReplacementPlugin, [
/monaco-editor(\\|\/)esm(\\|\/)vs(\\|\/)editor(\\|\/)common(\\|\/)services/,
path.resolve(__dirname, 'node_modules/monaco-editor/esm')
])
}
// Force mjs to just be interpreted as regular JS
config.module
.rule('mjs')
.test(/\.mjs$/)
.type('javascript/auto')
.include.add(/node_modules/)
// Make the default target electron-renderer
config.target('electron-renderer')
},
pluginOptions: {
electronBuilder: {
builderOptions: require('./package.json').build,
chainWebpackMainProcess(config) {
config.module
.rule('files')
.test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
.use('file-loader')
.loader('file-loader')
.options({
name: 'imgs/[name]--[folder].[ext]'
})
addNodeSupport(config)
config.resolve.alias.merge(aliases)
config
.plugin('envVars')
.use(webpack.DefinePlugin, [require('./env-variables.config').main])
return config
},
chainWebpackRendererProcess(config) {
config
.entry('app')
.clear()
.add('./src/renderer/main.js')
config.module.rule('svg').uses.delete('file-loader')
config.module
.rule('svg')
.use('url-loader')
.loader('url-loader')
addNodeSupport(config)
return config
},
// Use this to change the entrypoint of your app's main process
mainProcessFile: 'src/main/index.js'
// Provide an array of files that, when changed, will recompile the main process and restart Electron
// Your main process file will be added by default
// mainProcessWatch: ['src/myFile1', 'src/myFile2']
}
},
css: {
loaderOptions: {
css: {
camelCase: true
}
}
}
}
function addNodeSupport(config) {
config.resolve.extensions
.add('.js')
.add('.vue')
.add('.node')
config.module
.rule('node')
.test(/\.node$/)
.use('node-loader')
.loader('node-loader')
}