forked from inowas/inowas-dss-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
130 lines (127 loc) · 4.6 KB
/
webpack.config.babel.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
'use strict';
import { DefinePlugin, HotModuleReplacementPlugin, NamedModulesPlugin, NoEmitOnErrorsPlugin } from 'webpack';
import FaviconsWebpackPlugin from 'favicons-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
export default {
devtool: "#inline-source-map",
devServer: {
historyApiFallback: true,
hot: true,
stats: 'minimal',
host: "0.0.0.0",
disableHostCheck: true
},
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
path.resolve( __dirname, 'src/less/main.less' ),
path.resolve( __dirname, 'src/index.jsx' )
],
output: {
path: path.resolve( __dirname, 'build/' ),
filename: '[name].js',
publicPath: '/',
sourceMapFilename: '[name].map'
},
plugins: [
new HtmlWebpackPlugin( {
template: 'src/index.tpl.html',
inject: 'body',
filename: 'index.html'
} ),
new HotModuleReplacementPlugin(),
new NoEmitOnErrorsPlugin(),
new NamedModulesPlugin(),
new DefinePlugin( {
'process.env.NODE_ENV': JSON.stringify( 'development' )
} ),
new FaviconsWebpackPlugin( 'images/favicon.png' ),
],
module: {
rules: [
{
test: /\.jsx?$/,
use: [ 'source-map-loader' ],
enforce: 'pre'
}, {
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: __dirname
}, {
test: /\.less$/,
use: [ {
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
sourceMap: true,
importLoaders: 2
}
}, {
loader: 'postcss-loader',
options: {
sourceMap: true
}
}, {
loader: 'less-loader',
options: {
sourceMap: true
}
} ]
}, {
test: /\.(png|jpe?g|gif|svg)$/,
exclude: /icons/,
use: [ {
loader: 'file-loader',
options: {
name: 'images/[name]---[hash:base64:5].[ext]'
}
} ]
}, {
test: /\.svg$/,
include: /icons/,
use: [ {
loader: 'babel-loader'
}, {
loader: 'react-svg-loader',
query: {
jsx: true,
svgo: {
plugins: [ {
removeStyleElement: true,
cleanupAttrs: true,
cleanupIDs: true,
mergePaths: true,
removeUselessStrokeAndFill: true,
removeUnusedNS: true,
cleanupNumericValues: true
} ],
floatPrecision: 2,
pretty: true
}
}
} ]
},
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=fonts/[name].[hash:4].[ext]'},
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=fonts/[name].[hash:4].[ext]&mimetype=application/font-woff'},
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,loader: 'file-loader?name=fonts/[name].[hash:4].[ext]&mimetype=application/font-woff'},
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader?name=fonts/[name].[hash:4].[ext]&mimetype=application/octet-stream'},
{ test: /\.csv$/, loader: 'raw-loader'}
]
},
resolve: {
modules: [ path.resolve( __dirname, './src' ), 'node_modules' ],
descriptionFiles: [ 'package.json' ],
mainFiles: [ 'index' ],
extensions: [ '.js', '.jsx' ],
enforceExtension: false,
alias: {
styleGlobals: path.resolve( __dirname, 'src/styles/styleGlobals' ),
ConfiguredRadium: path.resolve( __dirname, 'src/styles/ConfiguredRadium' ),
ConfiguredAxios: path.resolve( __dirname, 'src/api/ConfiguredAxios' )
}
}
};