forked from artcom/react-three-arjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·53 lines (51 loc) · 1.39 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
/* eslint-disable no-undef */
const HtmlWebpackPlugin = require("html-webpack-plugin")
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin")
const CopyWebpackPlugin = require("copy-webpack-plugin")
const path = require("path")
module.exports = (_, { mode }) => ({
entry: {
main: "./src/index.js",
},
devServer: {
host: "0.0.0.0",
hot: true,
},
resolve: {
alias: {
react: path.resolve("./node_modules/react"),
three: path.resolve("./node_modules/three"),
"react-dom": path.resolve("./node_modules/react-dom"),
"@react-three/fiber": path.resolve("./node_modules/@react-three/fiber"),
},
},
plugins: [
mode === "development" && new ReactRefreshWebpackPlugin(),
new HtmlWebpackPlugin({
template: "src/index.html",
}),
new CopyWebpackPlugin({
patterns: [
{ from: "./node_modules/@ar-js-org/artoolkit5-js/data/", to: "data/" },
{ from: "./data/", to: "data/" },
],
}),
].filter(Boolean),
devtool: mode === "development" ? "eval-source-map" : "source-map",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: {
plugins: [mode === "development" && "react-refresh/babel"].filter(Boolean),
},
},
],
},
],
},
})