-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
81 lines (80 loc) · 2.05 KB
/
webpack.common.js
File metadata and controls
81 lines (80 loc) · 2.05 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
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
const webpack = require('webpack');
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const copyWebpackPlugin = require('copy-webpack-plugin');
const NODE_ENV = process.env.NODE_ENV;
const PROJECT_ROOT = path.resolve(__dirname, '../../..');
const OUTPUT_DIR = path.resolve(PROJECT_ROOT, 'build');
module.exports = {
plugins: [
new htmlWebpackPlugin({
template: path.resolve(__dirname, 'src/public/index.html'),
hash: NODE_ENV !== 'none',
}),
new webpack.EnvironmentPlugin({
NODE_ENV: process.env.NODE_ENV,
}),
new copyWebpackPlugin({
patterns: [
{from: path.resolve(__dirname, 'src/assets/images'), to: path.resolve(OUTPUT_DIR, 'images')},
],
}),
],
mode: NODE_ENV,
performance: {
hints: false,
maxEntrypointSize: 5000000,
maxAssetSize: 5000000,
},
stats: {
colors: true,
},
entry: {
index: path.resolve(PROJECT_ROOT, 'src/index'),
algorithm: path.resolve(PROJECT_ROOT, 'src/GeneticAlgorithm'),
'worker-controller.worker': '@technote-space/worker-controller/dist/Worker/worker-controller.worker',
process: path.resolve(__dirname, 'dist/app/logic/Process/Process'),
},
output: {
path: OUTPUT_DIR,
filename: '[name].js',
},
resolve: {
mainFields: ['browser', 'main', 'module'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
module: {
rules: [
{
test: /\.(jsx?|tsx?)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: require('./babel.config'),
},
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader',
options: {
minimize: true,
},
},
],
},
{
test: /\.(|gif|jpeg|jpg|png|svg|txt)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
],
},
};