-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
82 lines (79 loc) · 1.88 KB
/
webpack.config.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
const PATH = require('path');
//const DIST_PATH = 'dist';
const DIST_PATH = 'src/backend/static';
const OUTPUT_PATH = PATH.resolve(__dirname , DIST_PATH);
const HTML_WEBPACK_PLUGIN = require('html-webpack-plugin');
const MINI_CSS_EXTRACT_PLUGIN = require('mini-css-extract-plugin');
const ESLINT_WEBPACK_PLUGIN = require('eslint-webpack-plugin');
const BROWSER_SYNC_PLUGIN = require('browser-sync-webpack-plugin');
module.exports = {
mode: "development",
target: ["web", "es5"],
devServer: {
static: {
directory: PATH.join(__dirname, DIST_PATH)
},
port: 8080,
historyApiFallback: true
},
entry: ['react','react-dom/client'],
output: {
filename: '[name].[contenthash]].js',
path: OUTPUT_PATH
},
module: {
rules: [
{
test: /\.(jsx)?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: 'ts-loader'
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.s?css$/,
use: [
MINI_CSS_EXTRACT_PLUGIN.loader,
'css-loader',
'postcss-loader',
'sass-loader',
]
},
{
test: /\.(png|jpg)/i,
loader: 'url-loader',
options: {
limit: 0,
name: 'images/[name].[contenthash]].[ext]'
}
}
]
},
resolve: {
extensions: ['.ts','.tsx','.js','.jsx','.css','.json']
},
plugins: [
new HTML_WEBPACK_PLUGIN({
template: "./src/frontend/html/index.html",
filename: "index.html"
}),
new MINI_CSS_EXTRACT_PLUGIN({
filename: '[name].[contenthash]].css'
}),
new ESLINT_WEBPACK_PLUGIN({
extensions: ['ts','tsx','js','jsx']
}),
new BROWSER_SYNC_PLUGIN({
host: 'localhost',
port: 8080,
server: { baseDir: DIST_PATH }
})
]
};