-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
74 lines (72 loc) · 2.05 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
72
73
74
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require('path');
const index = new HtmlWebpackPlugin({
filename: "index.html",
template: "./source/pages/index.pug"
})
module.exports = {
entry: "./source/code/tools.ts",
output: {
path: __dirname + "/build",
filename: "index_bundle.js",
},
mode: "development",
plugins: [index],
resolve: {
extensions: ['.ts', '...'],
fallback: {
'fs': false
}
},
resolveLoader: {
modules: ['node_modules', path.resolve(__dirname, 'loaders')]
},
module: {
rules: [
// {
// test: /\.ts$/,
// use: { loader: 'ts-loader' },
// exclude: /node_modules/,
// },
{
test: /\.pug$/,
use: {
loader: 'pug-loader',
options: { root: path.resolve(__dirname, 'source/pages') }
},
},
{
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' }
]
},
{
test: /\.(png|jpe?g|gif|bmp|tiff?|webp)$/,
type: 'asset/resource',
generator: { filename: 'img/[name]_[hash:4][ext]' }
},
{
test: /\.(webm|mkv|avi|mp4|m4v)$/,
type: 'asset/resource',
generator: { filename: 'vid/[name]_[hash:4][ext]' }
},
{
test: /\.(obj|gltf|glb|stl)$/,
type: 'asset/resource',
generator: { filename: 'dat/[name]_[hash:4][ext]' }
},
{
test: /\.(eot|otf|ttf|woff|woff2)$/,
type: 'asset/resource',
generator: { filename: 'fnt/[name]_[hash:4][ext]' }
},
{
test: /\.(json)$/,
type: 'asset/source',
generator: { filename: 'dat/[name]_[hash:4][ext]' }
},
]
}
};