-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
87 lines (86 loc) · 2.47 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
75
76
77
78
79
80
81
82
83
84
85
86
87
const path = require("path");
const pkg = require("./package.json");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const buildPath = "./build/";
module.exports = {
entry: { index: "./src/app.js" },
output: {
path: path.join(__dirname, buildPath),
filename: "[name].[hash].js",
publicPath: `/${pkg.repository}/`,
},
target: "web",
devtool: "source-map",
module: {
rules: [
{
test: /\.obj$/,
loader: "webpack-obj-loader",
exclude: path.resolve(__dirname, "./node_modules/"),
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "fonts/",
},
},
],
},
{
test: /\.js$/,
use: "babel-loader",
exclude: path.resolve(__dirname, "./node_modules/"),
},
{
test: /\.(jpe?g|png|gif|svg|tga|gltf|glb|babylon|mtl|pcb|pcd|prwm|obj|mat|mp3|ogg)$/i,
use: "file-loader",
exclude: path.resolve(__dirname, "./node_modules/"),
},
{
test: /\.(vert|frag|glsl|shader|txt)$/i,
use: "raw-loader",
exclude: path.resolve(__dirname, "./node_modules/"),
},
{
type: "javascript/auto",
test: /\.(json)/,
exclude: path.resolve(__dirname, "./node_modules/"),
use: [
{
loader: "file-loader",
},
],
},
],
},
resolve: {
alias: {
progress$: path.resolve(__dirname, "src/components/progress"),
health$: path.resolve(__dirname, "src/components/health"),
menu$: path.resolve(__dirname, "src/components/menu"),
virus$: path.resolve(__dirname, "src/components/virus"),
upgrade$: path.resolve(__dirname, "src/components/upgrade"),
boss$: path.resolve(__dirname, "src/components/boss"),
lights$: path.resolve(__dirname, "src/components/lights"),
objects$: path.resolve(__dirname, "src/components/objects"),
scenes$: path.resolve(__dirname, "src/components/scenes"),
perlin$: path.resolve(__dirname, "src/components/perlin"),
level$: path.resolve(__dirname, "src/components/level"),
},
},
plugins: [
new HtmlWebpackPlugin({
title: pkg.title,
favicon: "src/favicon.ico",
template: "src/index.html",
}),
],
};