-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathwebpack.config.js
63 lines (57 loc) · 1.53 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
const HtmlWebpackPlugin = require("html-webpack-plugin")
const InlinePlugin = require("html-inline-script-webpack-plugin")
const path = require("path")
const fs = require('fs')
let plugins = [
new HtmlWebpackPlugin({
template: './src/index.html',
inject: "body",
})
]
// Build to the dist folder by default
let output = "./dist"
// If I'm coding on my VPS, build to the beta page on willard.fun
if (__dirname.includes("willard/server/dev")) {
output = "../../public/minekhan/beta"
}
// If I'm coding on my desktop, and have my VPS mounted, build to the beta page on willard.fun
else if (__dirname.includes("/home/willard/Desktop/MineKhan")) {
if (fs.readdirSync("/home/willard/vps").includes("server")) {
output = "/home/willard/vps/server/public/minekhan/beta"
}
}
// Bundle the JS into the HTML file; makes debugging harder, and breaks webpack's auto build
// plugins.push(new InlinePlugin())
module.exports = {
mode: "none",
entry: "./src/main.js",
output: {
path: path.resolve(__dirname, output),
filename: "main.js",
},
module: {
rules: [
{
test: /\.css$/i,
use: [{
loader: 'style-loader',
// options: {
// insert: 'head', // insert style tag inside of <head>
// injectType: 'singletonStyleTag'
// },
}, "css-loader"],
},
{
test: /\.(txt|glsl)$|workers(\/|\\)/i,
use: "raw-loader",
},
],
},
plugins,
watch: true,
watchOptions: {
aggregateTimeout: 100,
// poll: 1000,
ignored: '**/node_modules',
},
}