-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
57 lines (54 loc) · 1.47 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
/* eslint-env node */
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { version } = require('./package.json')
const BUILD_FOLDER = path.join(__dirname, 'build')
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: {
index: './src/index.js',
analytics: './analytics/index.js',
test: './test/index.js'
},
output: {
path: BUILD_FOLDER,
filename: '[name].bundle.js'
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ context: './src', from: '*.css' },
{ context: './src', from: '*.gif' },
{ context: './src', from: 'hello.js' },
{ context: './src', from: 'hello.wasm' },
{ from: './models', to: 'models/' },
{ from: './rawImages', to: 'rawImages/' }
]
}),
new HtmlWebpackPlugin({
template: './src/index.html',
filename: path.resolve(BUILD_FOLDER, 'index.html'),
chunks: ['index'],
version
}),
new HtmlWebpackPlugin({
template: './analytics/index.html',
filename: path.resolve(BUILD_FOLDER, 'analytics.html'),
chunks: ['analytics'],
version
}),
new HtmlWebpackPlugin({
template: './test/index.html',
filename: path.resolve(BUILD_FOLDER, 'test.html'),
chunks: ['test'],
version
})
],
devtool: 'source-map',
devServer: {
proxy: {
'/api': 'http://localhost:3090',
},
}
}