forked from department-of-veterans-affairs/vets-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
91 lines (83 loc) · 2.29 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
// Staging config. Also the default config that prod and dev are based off of.
var path = require('path');
var webpack = require('webpack');
var config = {
entry: "./assets/js/entry.js",
output: {
path: path.join(__dirname, "assets/js/generated/dev"),
publicPath: "/assets/js/generated/dev/",
filename: "bundle.js"
},
devtool: '#cheap-module-eval-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
// es2015 is current name for the es6 settings.
presets: ['es2015'],
// Share polyfills between files.
plugins: ['transform-runtime'],
// Speed up compilation.
cacheDirectory: true
}
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: 'babel',
query: {
// es2015 is current name for the es6 settings.
presets: ['es2015', 'react'],
// Share polyfills between files.
plugins: ['transform-runtime'],
// Speed up compilation.
cacheDirectory: true
}
},
{
// components.js is effectively a hand-rolled bundle.js. Break it apart.
test: /components\.js$/,
loader: "imports?this=>window"
},
{
test: /foundation\.js$/,
loader: "imports?this=>window"
},
{
test: /\.modernizrrc/,
loader: "modernizr"
},
{
// Loaders are executed bottom to top, right to left. This MUST
// appear before the \.coffee loader.
test: /wow\.coffee$/,
loaders: [ "imports?this=>window", "exports?this.WOW" ]
},
{
test: /\.coffee$/, loader: "coffee-loader"
}
]
},
resolve: {
alias: {
modernizr$: path.resolve(__dirname, "./.modernizrrc"),
jquery: "jquery/src/jquery"
},
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_TYPE === "dev"))
}),
// See http://stackoverflow.com/questions/28969861/managing-jquery-plugin-dependency-in-webpack
new webpack.ProvidePlugin({
"$": "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
})
],
};
module.exports = config;