-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.ui.config.js
92 lines (84 loc) · 1.78 KB
/
webpack.ui.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
const CopyPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const WebpackBuildNotifierPlugin = require('webpack-build-notifier')
const config = {
mode: 'production',
context: path.join(__dirname, 'src', 'ui'),
entry: ['./index.js'],
output: {
path: path.join(__dirname, 'assets', 'ui'),
filename: 'index.js'
},
resolve: {
// .mjs needed for https://github.com/graphql/graphql-js/issues/1272
extensions: ['.js', 'jsx', '.mjs']
},
module: {
rules: [
{
test: /\.jsx?$/,
use: [
{
loader: 'babel-loader'
}
]
},
{
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
modules: true
}
}
]
},
{
test: /\.svg$/,
use: ['@svgr/webpack']
},
{
// fixes https://github.com/graphql/graphql-js/issues/1272
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './static/index.html',
filename: 'index.html',
inject: 'body'
}),
new CopyPlugin([
{
from: './static/global.css',
to: 'global.css'
}
])
],
target: 'electron-renderer'
}
module.exports = env => {
if (!env || env === 'development') {
return {
...config,
mode: 'development',
plugins: [
...config.plugins,
new WebpackBuildNotifierPlugin({
title: 'Hypha Build'
})
],
watch: true,
watchOptions: {
aggregateTimeout: 500
}
}
}
return config
}