-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
43 lines (41 loc) · 1.31 KB
/
webpack.config.js
File metadata and controls
43 lines (41 loc) · 1.31 KB
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
// Wipe dist on every build so stale artefacts don't accumulate
clean: true,
},
module: {
rules: [
{
test: /\.html$/,
use: ['html-loader'],
},
],
},
plugins: [
// Generates dist/index.html automatically on every build.
// No more manual creation or silent loss on clean builds.
new HtmlWebpackPlugin({
title: 'CEMRG: VR Model Demo',
// Injects the <script src="main.js"> automatically
inject: 'body',
}),
// Copies data/ into dist/data/ on every build.
// The mesh files are fetched at runtime via HTTP (not bundled),
// so webpack would never discover them through import analysis alone.
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, 'data'),
to: path.resolve(__dirname, 'dist/data'),
},
],
}),
],
};