This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
95 lines (90 loc) · 2.66 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
// Staging config. Also the default config that prod and dev are based off of.
var path = require('path');
var webpack = require('webpack');
var bourbon = require('bourbon').includePaths;
var neat = require('bourbon-neat').includePaths;
var ExtractTextPlugin = require('extract-text-webpack-plugin');
require('babel-polyfill');
var config = {
entry: ['babel-polyfill', './src/client.js'],
output: {
path: path.join(__dirname, 'generated'),
publicPath: '/healthcare/apply/application/generated/',
filename: 'bundle.js'
},
devtool: process.env.NODE_ENV === 'production' ? '#source-map' : '#cheap-module-eval-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
// Speed up compilation.
cacheDirectory: true
}
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['react'],
// 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'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css!resolve-url!sass?includePaths[]=' + bourbon + '&includePaths[]=' + neat + '&includePaths[]=' + '~/uswds/src/stylesheets' + '&sourceMap')
},
{ test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'url?limit=10000!img?progressive=true&-minimize'
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&minetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}
]
},
resolve: {
alias: {
modernizr$: path.resolve(__dirname, './.modernizrrc'),
},
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.NODE_ENV === undefined || process.env.NODE_ENV === 'development'))
}),
new ExtractTextPlugin('bundle.css'),
],
};
module.exports = config;