-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
71 lines (70 loc) · 1.74 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: [path.resolve(__dirname, 'src/index.js')],
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/index.html'),
}),
new FaviconsWebpackPlugin({
logo: './src/img/icon.svg',
cache: true,
prefix: 'assets/',
inject: true,
favicons: {
appName: 'Deforestation Detector',
appDescription:
'Deforestation Detector uses an image recognition model to detect deforestation in satellite imagery.',
theme_color: '#333366',
},
}),
new MiniCssExtractPlugin(),
],
module: {
// rules to handle certain file types
rules: [
// HTML
{
test: /\.html$/,
use: 'html-loader',
},
// CSS
{
test: /\.s[ac]ss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
// Images
{
test: /\.(jpg|png|gif|svg|jpeg)$/,
type: 'asset/resource',
generator: {
filename: 'assets/images/[hash][ext]',
},
},
// Shaders
{
test: /\.(glsl|vs|fs|vert|frag)$/,
use: ['raw-loader', 'glslify-loader'],
},
// Models
{
test: /\.(gltf|obj|glb)$/,
type: 'asset/resource',
generator: {
filename: 'assets/models/[hash][ext]',
},
},
],
},
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
},
port: 9000,
hot: true,
liveReload: true,
watchFiles: ['src/**/*'],
},
};