forked from getsentry/sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
97 lines (92 loc) · 2.46 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*eslint-env node*/
var path = require("path"),
webpack = require("webpack"),
ExtractTextPlugin = require("extract-text-webpack-plugin");
var staticPrefix = "src/sentry/static/sentry",
distPath = staticPrefix + "/dist";
var config = {
context: path.join(__dirname, staticPrefix),
entry: {
// js
"app": "app",
"vendor": [
"babel-core/polyfill",
"bootstrap/js/dropdown",
"bootstrap/js/tab",
"bootstrap/js/tooltip",
"bootstrap/js/alert",
"crypto-js/md5",
"jquery",
"marked",
"moment",
"moment-timezone",
"raven-js",
"react-document-title",
"react-router",
"react-bootstrap",
"reflux",
"select2",
"flot/jquery.flot",
"flot/jquery.flot.stack",
"flot/jquery.flot.time",
"flot-tooltip/jquery.flot.tooltip",
"vendor/simple-slider/simple-slider"
],
// css
// NOTE: this will also create an empty "sentry.js" file
// TODO: figure out how to not generate this
"sentry": "less/sentry.less"
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: "babel-loader",
include: path.join(__dirname, staticPrefix),
exclude: /(vendor|node_modules)/
},
{
test: /\.json$/,
loader: "json-loader"
},
{
test: /\.less$/,
include: path.join(__dirname, staticPrefix),
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
},
{
test: /\.(woff|woff2|ttf|eot|svg|png|gif|ico|jpg)($|\?)/,
loader: 'file-loader?name=' + '[name].[ext]'
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js"),
new webpack.optimize.DedupePlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
"window.jQuery": "jquery",
"root.jQuery": "jquery",
Raven: "raven-js"
}),
new ExtractTextPlugin("[name].css")
],
resolve: {
alias: {
"flot": path.join(__dirname, staticPrefix, "vendor", "jquery-flot"),
"flot-tooltip": path.join(__dirname, staticPrefix, "vendor", "jquery-flot-tooltip")
},
modulesDirectories: [path.join(__dirname, staticPrefix), "node_modules"],
extensions: ["", ".jsx", ".js", ".json"]
},
output: {
path: distPath,
filename: "[name].js",
libraryTarget: "var",
library: "exports",
sourceMapFilename: "[name].js.map",
},
devtool: 'source-map'
};
module.exports = config;