-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.mocha.js
62 lines (61 loc) · 1.34 KB
/
webpack.mocha.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
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
const { WebpackPluginServe } = require('webpack-plugin-serve');
const path = require('path');
module.exports = {
mode: 'development',
entry: [
path.resolve(__dirname, 'test/index.js'),
'webpack-plugin-serve/client',
],
plugins: [new MiniHtmlWebpackPlugin()],
module: {
// rules to handle certain file types
rules: [
// test files
{
test: /test\.js$/,
use: 'mocha-loader',
},
// HTML
{
test: /\.html$/,
use: 'html-loader',
},
// CSS
{
test: /\.s[ac]ss$/,
use: ['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: 8080,
hot: true,
liveReload: true,
watchFiles: ['src/**/*'],
},
};