forked from tbolis/react-sketch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.examples.cfg.js
60 lines (56 loc) · 1.94 KB
/
webpack.examples.cfg.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
/*global __dirname,module*/
const path = require('path');
const srcPath = path.join(__dirname, 'src');
const examplesPath = path.join(__dirname, 'examples');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const OccurrenceOrderPlugin = require('webpack/lib/optimize/OccurrenceOrderPlugin');
const AggressiveMergingPlugin = require('webpack/lib/optimize/AggressiveMergingPlugin');
const config = {
entry: {
examples: path.join(examplesPath, 'run')
},
output: {
path: path.join(__dirname, '/build'),
filename: 'index.js',
publicPath: ''
},
resolve: {
extensions: ['.js', '.jsx']
},
cache: true,
devtool: 'source-map',
module: {
loaders: [
{test: /\.html$/, loader: 'html-loader', include: [examplesPath], exclude: /base\.html$/},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{
test: /\.(js|jsx)$/,
include: [srcPath, examplesPath],
exclude: /(node_modules|bower_components|lib)/,
loaders: ['babel-loader']
}
]
},
plugins: [
new UglifyJsPlugin(),
new OccurrenceOrderPlugin(),
new AggressiveMergingPlugin(),
new DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new HtmlWebpackPlugin({
title: 'React Sketch',
description: 'Sketch Element for React based applications, backed-up by fabricjs as its core',
keywords: ['react', 'canvas', 'sketch', 'fabricjs', 'fabric.js'],
template: path.join(examplesPath, 'base.html'),
filename: 'index.html',
chunks: ['examples'],
inject: 'body'
})
]
};
module.exports = config;