-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (87 loc) · 2.78 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
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
var path = require('path');
var autoprefixer = require('autoprefixer');
module.exports = {
entry: {
app: './app/index.tsx'
},
module: {
rules: [
{
test: /\.tsx?$/,
use: require.resolve('ts-loader'),
include: [
path.resolve(__dirname, 'app')
],
exclude: /node_modules/
},
{
test: /\.css$|\.less$/,
use: [
require.resolve('style-loader'),
require.resolve('css-loader'),
{
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
plugins: () => [
autoprefixer({
browsers: [
'last 2 versions',
'not ie < 9', // React doesn't support IE8 anyway
]
}),
],
}
},
},
{
loader: require.resolve('less-loader')
},
],
},
{
exclude: [
/\.html$/,
/\.(js|jsx|tsx)$/,
/\.css$/,
/\.less$/,
/\.json$/,
/\.bmp$/,
/\.gif$/,
/\.jpe?g$/,
/\.png$/,
],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[ext]',
},
},
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[ext]',
},
},
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
modules: ['.', 'node_modules']
},
devServer: {
port: 8080,
inline: true,
overlay: true,
},
output: {
filename: '[name].bundle.js',
publicPath: 'http://localhost:8080',
path: path.resolve(__dirname, 'dist')
},
devtool: 'inline-source-map'
};