forked from ntabernero/center-ui
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
88 lines (85 loc) · 3.36 KB
/
Copy pathwebpack.config.js
File metadata and controls
88 lines (85 loc) · 3.36 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
79
80
81
82
83
84
85
86
87
88
var path = require("path");
var webpack = require("webpack");
var ENV = process.env.NODE_ENV || "development";
module.exports = {
// This is the main file that should include all other JS files
entry: "./app/js/main.js",
target: "web",
debug: true,
cache: true,
output: {
path: path.join(__dirname, "dist/assets"),
publicPath: "assets/",
// If you want to generate a filename with a hash of the content (for cache-busting)
// filename: "main-[hash].js",
filename: "main.js",
chunkFilename: "webpack.[hash].js"
},
resolve: {
alias: {
react$: "react/addons",
jquery$: "jquery/dist/jquery",
bootstrap$: "bootstrap-sass/assets/javascripts/bootstrap",
carouFredSel$: "carouFredSel/jquery.carouFredSel-6.2.1",
lodash: "lodash-amd/modern",
"magnific-popup$": "magnific-popup/dist/jquery.magnific-popup",
w2ui$: "w2ui/dist/w2ui",
classification$: "ozp-classification/jquery.classification.js",
"underscore$": "underscore/underscore.js",
"ism-u.config$": "ism-u.config.js",
"ism$": "bootstrap-classify/js/ism.js",
"bootstrap-classify$": "bootstrap-classify/js/bootstrap-classify.js",
"ozp-react-commons": "ozp-react-commons/app/js",
tether$: "tether/tether",
bootstrapjs$: "bootstrap/dist/js/bootstrap.js",
tour$: "bootstrap-tour/build/js/bootstrap-tour.js"
},
// Configure webpack to look for required files in bower and node
modulesDirectories: ['./node_modules', './config']
},
module: {
loaders: [
{ test: /\.jsx$/, loader: "eslint-loader", exclude: /node_modules/ },
{ test: /\.js$/, loader: "eslint-loader", exclude: /node_modules/ },
{ test: /\.gif/, loader: "url-loader?limit=10000&mimetype=image/gif" },
{ test: /\.jpg/, loader: "url-loader?limit=10000&mimetype=image/jpg" },
{ test: /\.png/, loader: "url-loader?limit=10000&mimetype=image/png" },
{
test: /\.jsx?$/,
loader: "jsx-loader?insertPragma=React.DOM!babel-loader",
include: [
path.join(__dirname, 'app/js'),
path.join(__dirname, 'node_modules/ozp-react-commons/app/js')
]
},
// This is done separetly to not add 'use strict' as the plugin leaks global vars
// When this is fixed, include below can be moved in the above config
{
test: /\.jsx?$/,
loader: "jsx-loader",
include: [
path.join(__dirname, 'node_modules/react-datepicker/src')
]
}
],
noParse: /\.min\.js/
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
// This has effect on the react lib size
"NODE_ENV": JSON.stringify(ENV),
}
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin({
minSizeReduce: 1.5,
moveToParents: true
})
]
};