-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
51 lines (50 loc) · 1.58 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
const path = require('path');
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: {
'main': './js/defaultAnalysis.js',
'single': './js/singleAnalysis.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
splitChunks: {
chunks: "all"
}
},
mode: 'development',
plugins: [
new CopyPlugin({
patterns: [
{ from: "images", to: "images" },
{ from: "styles", to: "styles" },
],
}),
new HtmlWebpackPlugin({
filename: "main.html",
template: 'main.html',
chunks: ['main']
}),
new HtmlWebpackPlugin({
filename: "single.html",
template: 'single.html',
chunks: ['single']
}),
// Note: devServer below serves data directory at its root. Therefore, ./healthy is mapped to data/healthy.
// When using your own dataset, modify the variable below and the devServer static directory (if using devServer).
new webpack.DefinePlugin({
DATA_DIR: JSON.stringify('./healthy')
})
],
devServer: {
// There is no need to include explicitly include the dist output directory
// because the devServer automatically serves the exports from above
static: {directory: path.join(__dirname, 'data')},
compress: true,
port: 9000
}
};