-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
62 lines (57 loc) · 1.39 KB
/
webpack.config.js
File metadata and controls
62 lines (57 loc) · 1.39 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
devtool: 'eval-source-map',
entry: {
main: `${__dirname}/src/app/app.jsx`,
vendor: [
'react', 'react-dom',
],
},
output: {
filename: '[name].[hash].js',
path: `${__dirname}/build`,
},
devServer: {
contentBase: './build',
historyApiFallback: true,
inline: true,
},
resolve: {
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: 'babel-loader',
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader',
}),
},
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
],
},
plugins: [
new HtmlWebpackPlugin({
title: 'pieces -- remember some pieces of you.',
template: './build/index.tmpl.html',
}),
new webpack.HashedModuleIdsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
}),
new ExtractTextPlugin('style.css'),
],
};