forked from wulkano/Kap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
91 lines (87 loc) · 2.32 KB
/
Copy pathwebpack.config.js
File metadata and controls
91 lines (87 loc) · 2.32 KB
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
const {join: pathJoin, resolve: resolvePath} = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
function joinPath(...paths) {
return pathJoin(...paths);
}
const SRC_MAIN = joinPath(__dirname, 'app', 'src', 'main');
const SRC_RENDERER = joinPath(__dirname, 'app', 'src', 'renderer');
const SRC_RENDERER_JS = joinPath(SRC_RENDERER, 'js');
const SRC_RENDERER_VIEWS = joinPath(SRC_RENDERER, 'views');
module.exports = {
node: {
__dirname: false
},
target: 'electron',
entry: {
main: joinPath(SRC_MAIN, 'index.js'),
'main-renderer': joinPath(SRC_RENDERER_JS, 'main.js'),
cropper: joinPath(SRC_RENDERER_JS, 'cropper.js'),
editor: joinPath(SRC_RENDERER_JS, 'editor.js'),
preferences: joinPath(SRC_RENDERER_JS, 'editor.js')
},
output: {
path: joinPath('app', 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js$/,
include: SRC_RENDERER,
exclude: [
resolvePath('node_modules'),
resolvePath('app', 'node_modules')
],
loader: 'babel-loader'
},
{
test: /\.pug$/,
loader: 'pug-loader'
},
{
test: /\.css$/,
include: SRC_RENDERER,
use: [
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins() {
return [
require('postcss-import'),
require('postcss-simple-vars'),
require('postcss-extend'),
require('postcss-nested'),
require('cssnano'),
require('postcss-reporter')()
];
}
}
}
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
inject: false,
filename: 'cropper.html',
template: joinPath(SRC_RENDERER_VIEWS, 'cropper.pug')
}),
new HtmlWebpackPlugin({
inject: false,
filename: 'editor.html',
template: joinPath(SRC_RENDERER_VIEWS, 'editor.pug')
}),
new HtmlWebpackPlugin({
inject: false,
filename: 'main.html',
template: joinPath(SRC_RENDERER_VIEWS, 'main.pug')
}),
new HtmlWebpackPlugin({
inject: false,
filename: 'preferences.html',
template: joinPath(SRC_RENDERER_VIEWS, 'preferences.pug')
})
]
};