This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack.config.js
99 lines (92 loc) · 2.82 KB
/
webpack.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
const path = require('path')
const { dependencies } = require('./package.json')
const {VueLoaderPlugin} = require('vue-loader');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
let rendererConfig = {
mode: process.env.NODE_ENV == 'production' ? 'production' : 'development',
entry: {
renderer: path.join(__dirname, 'src/renderer/renderer.ts'),
main: path.join(__dirname, 'src/main/main.ts')
},
optimization: {
minimize: process.env.NODE_ENV == 'production' && !process.env.FIRO_CLIENT_TEST
},
externals: Object.keys(dependencies),
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.s[ac]ss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.css$/,
use: 'css-loader'
},
{
test: /\.html$/,
use: 'vue-html-loader'
},
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
}
}
},
{
test: /\.node$/,
use: 'node-loader'
},
{
test: /\.ttf$/,
type: 'asset/resource'
},
{
test: /\.svg\.data$/,
use: {
loader: 'url-loader',
options: {
mimetype: 'image/svg+xml'
}
}
}
]
},
node: {
__dirname: process.env.NODE_ENV !== 'production',
__filename: process.env.NODE_ENV !== 'production'
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, 'src/index.ejs'),
nodeModules: process.env.NODE_ENV === 'production' ? false : path.resolve(__dirname, 'node_modules')
})
],
output: {
filename: '[name].js',
libraryTarget: 'commonjs2',
path: path.join(__dirname, 'dist/electron')
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
'fonts': path.resolve(__dirname, 'assets', 'fonts')
},
modules: ['src', 'node_modules'].map(x => path.join(__dirname, x)),
extensions: ['.js', '.vue', '.json', '.css', '.scss', '.node', '.ts', '.d.ts', '.vue'],
plugins: [
new TsconfigPathsPlugin()
]
},
target: 'electron-renderer'
}
module.exports = rendererConfig