-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
78 lines (76 loc) · 2.17 KB
/
webpack.config.js
File metadata and controls
78 lines (76 loc) · 2.17 KB
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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
bundle: './src/index.jsx'
},
output: {
path: __dirname + '/dist',
filename: '[name].js'
},
resolve: {
alias: {
assets: path.resolve(__dirname, 'src/assets'),
helpers: path.resolve(__dirname, 'src/helpers'),
components: path.resolve(__dirname, 'src/components')
}
},
devServer: {
port: 8090,
historyApiFallback: {
index: 'index.html'
}
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader!autoprefixer-loader!less-loader'
})
},
{
test: /\.(png|svg|jpg)$/,
loader: 'file-loader?name=./img/[hash].[ext]'
},
{
test: /\.(ttf|woff|woff2|otf|eot)$/,
loader: 'file-loader?name=./fonts/[hash].[ext]'
},
{
test: /\.pdf$/,
loader: 'file-loader?name=./pdf/[hash].[ext]'
}
]
},
plugins: [new CleanWebpackPlugin(['dist'], {
root: path.resolve(__dirname),
verbrose: true
}),
new HtmlWebpackPlugin({
title: 'Theresa Chytilová',
template: path.resolve(__dirname, 'src/index.html')
}),
new ExtractTextPlugin({
filename: '[name].css',
allChunks: false
}),
new CopyWebpackPlugin([])]
};