-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.coffee
66 lines (60 loc) · 1.75 KB
/
webpack.config.coffee
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
path = require('path')
webpack = require('webpack')
StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin')
SitemapPlugin = require('sitemap-webpack-plugin')
ExtractTextPlugin = require('extract-text-webpack-plugin')
states = require('./data/states')
paths = ['/']
for key, _ of states
paths.push "/#{key}/" unless key is 'DA'
module.exports =
entry: './coffee/router'
output:
filename: 'production.min.js'
path: './dist'
libraryTarget: 'umd'
publicPath: '/'
module:
loaders: [
{
test: /\.coffee$/
loaders: ['coffee', 'cjsx']
}
{
test: /\.json$/
loader: 'json'
}
{
test: /\.scss$/
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!resolve-url-loader!sass-loader')
}
{
test: /\.(ttf|otf|png|ico|svg)$/
loader: 'file?name=[name].[ext]'
}
{
test: /\.csv?$/
loader: 'raw'
}
{
test: /[\/\\]node_modules[\/\\]datamaps[\/\\]dist[\/\\]datamaps.usa\.js$/
loader: 'imports?window=>{}'
}
]
plugins: [
new webpack.ProvidePlugin(
'window.d3': 'd3'
'window.topojson': 'topojson'
)
new StaticSiteGeneratorPlugin('main', paths)
new ExtractTextPlugin('production.min.css', allChunks: true)
new SitemapPlugin('https://vote.berniesanders.com', paths)
new webpack.DefinePlugin(
__PROD__: process.env.BUILD_PROD is 'true'
)
]
resolve:
alias:
d3: 'd3/d3.min.js'
root: [path.resolve('./coffee'), path.resolve('./'), path.resolve('./node_modules')]
extensions: ['', '.js', '.json', '.coffee', '.scss', '.csv']