-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
80 lines (74 loc) · 2.16 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
var webpack = require('webpack');
var path = require('path')
module.exports = {
entry: [
'./scripts/index.tsx'
],
resolve: {
root: [
path.resolve(__dirname, 'scripts'),
path.resolve(__dirname, 'styles'),
path.resolve(__dirname, 'img'),
path.resolve(__dirname, 'fonts'),
path.resolve(__dirname, 'node_modules'),
]
},
output: {
pathinfo: true,
path: path.resolve('dist'),
filename: "index.js",
},
module: {
loaders: [
{
test: /\.tsx?$/,
loader: "babel",
include: path.resolve(__dirname, 'scripts'),
exclude: /node_modules/,
query: {
presets: [
"es2015",
"react",
"stage-0",
"react-hmre"
],
plugins: ['transform-react-jsx-img-import']
},
},
{
test: /\.scss$/,
loaders: ["style", "css!sass"]
},
{
test: /\.(ttf|eot|svg|woff2?)(\?v=[a-z0-9=\.]+)?$/i,
include: path.resolve(__dirname, 'fonts'),
loader: 'file-loader?name=/[path][name].[ext]'
},
{
test: /\.(jpe?g|png|gif|svg|ico)$/i,
include: path.resolve(__dirname, 'img'),
loaders: [
'file-loader?name=/[path][name].[sha512:hash:base64:7].[ext]',
'image-webpack-loader' //?progressive=true&optimizationLevel=7&interlaced=true
]
},
{
test: /\.(html)$/i,
include: path.resolve(__dirname),
loaders: [
'file-loader?name=[name].[ext]'
]
}
]
},
plugins: [],
devServer: {
path: path.resolve(__dirname, "dist"),
historyApiFallback: {
index: '/index.html'
}
},
stats: {
colors: true,
},
}