-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-config-dev.js
94 lines (90 loc) · 1.84 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
83
84
85
86
87
88
89
90
91
92
93
94
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpackConfig = {
context: path.resolve(__dirname, 'src'),
entry: {
main: './index.tsx'
},
output: {
filename: '[name].bundle.js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js',
path: path.resolve(__dirname, './dist'),
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
filename: 'index.html',
})
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve(__dirname, 'node_modules')],
alias: {
components: path.resolve(__dirname, 'src/components/'),
services: path.resolve(__dirname, 'src/services/'),
styles: path.resolve(__dirname, 'src/styles/'),
icons: path.resolve(__dirname, 'src/icons'),
}
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.(t|j)sx?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
},
]
},
{
enforce: "pre",
test: /\.js$/,
exclude: /node_modules/,
loader: "source-map-loader"
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader'
},
{
loader: 'sass-loader'
}
]
},
{
test: /dranimate-fast\.wasm$/,
type: "javascript/auto",
loader: "file-loader",
options: {
name: "wasm/dranimate-fast.wasm"
}
}
]
},
devServer: {
https: false,
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
},
port: 5000,
host: 'localhost',
disableHostCheck: true
},
};
module.exports = webpackConfig;