-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
103 lines (98 loc) · 2.07 KB
/
Copy pathwebpack.config.js
File metadata and controls
103 lines (98 loc) · 2.07 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const Dotenv = require('dotenv-webpack');
const config = {
entry: './Application/src/index.ts',
target: 'web',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {}
}
},
{
test: /\.css$/i,
loader: 'css-loader',
options: {
exportType: 'string',
import: false
}
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource'
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource'
},
{
test: /\.svg$/,
type: 'asset/resource'
}
]
},
optimization: {
minimize: false
},
plugins: [
new CopyPlugin({
patterns: [
{
from: 'Application/public',
globOptions: {
ignore: ['**/index.html']
}
},
{
from: 'Application/src/Theme',
to: 'Theme'
}
]
}),
new HtmlWebpackPlugin({
template: 'Application/public/index.html'
}),
new Dotenv({
file: './.env',
defaults: './.env.dist'
})
],
output: {
filename: 'bundle.[fullhash].js',
path: path.resolve(__dirname, 'build'),
clean: true
},
resolve: {
fallback: {
'typescript': false,
'process': false
},
alias: {
Application: path.resolve(__dirname, 'Application/src'),
Core: path.resolve(__dirname, 'Core/src'),
Infrastructure: path.resolve(__dirname, 'Infrastructure/src')
}
},
devServer: {
port: 3000,
static: {
directory: path.join(__dirname, 'Application/public')
},
proxy: {
'/api': 'http://127.0.0.1:7072'
}
}
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {
config.devtool = 'inline-source-map';
}
return config;
};