-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
72 lines (64 loc) · 2.48 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
// requiring the libraries I need to use over here.
let ExtractTextPlugin = require("extract-text-webpack-plugin"),
webpack = require("webpack");
// creating the config function theat retturns an object specifying the configurations of the
// assets to be bundled.
module.exports = function (env) {
return {
context: __dirname,
entry: "./dev/js/index.js",
output: {
path: "./dist",
filename: "./js/react.vendor.min.js",
publicPath: "./dist"
},
module: {
loaders: [
{
test: /\.css$/,
exclude: "node_modules",
loader: ExtractTextPlugin.extract({ fallbackLoader: "style-loader", loader: "css-loader" })
},
{
test: /\.scss/,
loaders: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.(woff|woff2|eot|ttf|svg|otf)$/,
exclude: "node_modules",
loader: 'url-loader?limit=10000&&emitFile=false'
},
{
test: /\.(png|gif)$/,
exclude: "node_modules",
loader: "url-loader?limit=50000&&emitFile=false"
},
{
test: /\.(jpeg|jpg)$/,
exclude: "node_modules",
loader: "file-loader?emitFile=false"
},
{
test: /.jsx?$/,
loader: 'babel-loader'
},
{
// setting up babel for react components and es6 file extensions.
test: /\.(js|es6)$/,
loader: "babel-loader"
}
]
},
plugins: [
// extract the css files under multiple name.
new ExtractTextPlugin({ filename: "./css/vendor.min.css", allChunks: true, disable: false }),
new webpack.LoaderOptionsPlugin({debug:true, outputPathinfo: true, displayErrorDetails: true}),
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery', jquery: 'jquery', Tether: "tether"})
],
// devtool: "sourcemap",
watch: false
}
}