-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
50 lines (47 loc) · 1.35 KB
/
gulpfile.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
const gulp = require('gulp');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const named = require('vinyl-named');
const webpack = require('webpack-stream');
gulp.task('renderer', () => {
return gulp.src(['src/renderer/app.js'])
.pipe(named())
.pipe(webpack({
mode: process.env.NODE_ENV || 'development',
target: 'electron-renderer',
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.json', '.less']
},
module: {
rules: [
{
test: /\.m?jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.less$/,
loader: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']
}, {
test: /\.(woff2?|ttf|eot|svg)$/,
loader: 'url-loader'
}, {
test: /\.html$/,
loader: 'file-loader',
options: {
useRelativePath: true,
name: '[name].[ext]',
},
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css"
})
]
}))
.pipe(gulp.dest('public'));
});
gulp.task('watch', ['default'], () => {
gulp.watch(['src/**/*.js', 'src/**/*.jsx', 'src/**/*.less', 'src/**/*.html'], ['renderer']);
});
gulp.task('default', ['renderer']);