-
Notifications
You must be signed in to change notification settings - Fork 121
/
webpack.dev.js
87 lines (84 loc) · 2.69 KB
/
webpack.dev.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 { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
var entries = {};
entries['featured-viewer'] = './examples/featured-viewer/index.ts';
entries['basic-viewer'] = './examples/basic-viewer/index.ts';
entries['wexbim-files-viewer'] = './examples/wexbim-files-viewer/index.ts';
entries['pins'] = './examples/pins/index.ts';
entries['data-visualization'] = './examples/data-visualization/index.ts';
entries['3d-tracking'] = './examples/3d-tracking/index.ts';
module.exports = merge(common, {
entry: entries,
mode: "development",
devtool: 'inline-source-map',
plugins: [
new HtmlWebpackPlugin({
filename: 'featured-viewer/index.html',
template: './examples/featured-viewer/index.html',
chunks: ['featured-viewer', 'commons']
}),
new HtmlWebpackPlugin({
filename: 'basic-viewer/index.html',
template: './examples/basic-viewer/index.html',
chunks: ['basic-viewer', 'commons']
}),
new HtmlWebpackPlugin({
filename: 'wexbim-files-viewer/index.html',
template: './examples/wexbim-files-viewer/index.html',
chunks: ['wexbim-files-viewer', 'commons']
}),
new HtmlWebpackPlugin({
filename: 'pins/index.html',
template: './examples/pins/index.html',
chunks: ['pins', 'commons']
}),
new HtmlWebpackPlugin({
filename: 'data-visualization/index.html',
template: './examples/data-visualization/index.html',
chunks: ['data-visualization', 'commons']
}),
new HtmlWebpackPlugin({
filename: '3d-tracking/index.html',
template: './examples/3d-tracking/index.html',
chunks: ['3d-tracking', 'commons']
})
],
module: {
rules: [
{ test: /\.html$/, use: ["html-loader"] }
]
},
devServer: {
host: "localhost",
port: 9001,
open: "/",
hot: true,
devMiddleware: {
publicPath: "/dist/",
},
static: {
directory: path.join(__dirname, './'),
serveIndex: true,
},
client: {
overlay: {
warnings: true,
errors: true
}
}
},
optimization: {
splitChunks:{
cacheGroups: {
commons: {
name: "commons",
chunks: "initial",
minChunks: 2
}
}
}
}
});