forked from codeforamerica/brigade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
67 lines (59 loc) · 1.77 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
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ManifestRevisionPlugin = require('manifest-revision-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var rootAssetPath = './brigade/static';
var publicPath = process.env.ASSET_PATH || '/assets/';
module.exports = {
entry: {
application: rootAssetPath + '/js/application.js',
style: rootAssetPath + '/scss/style.scss',
cfaV3Style: rootAssetPath + '/scss/vendor/cfa-v3-style.css',
cfaV3Layout: rootAssetPath + '/scss/vendor/cfa-v3-layout.css',
},
output: {
path: path.resolve('./brigade/build/public'),
filename: '[name].[chunkhash].js',
chunkFilename: '[id].[chunkhash].js',
publicPath: publicPath
},
resolve: {
extensions: ['.js', '.css']
},
module: {
rules: [
{
test: /\.js$/i,
use: 'script-loader',
exclude: /node_modules/
},
{
test: /\.s?css$/i,
use: ExtractTextPlugin.extract({ use: ['css-loader','sass-loader'] }),
},
{
test: /\.(jpe?g|png|gif|txt|ico|eot|woff|ttf|otf|svg([\?]?.*))$/i,
loaders: [
'file-loader?context=' + rootAssetPath + '&name=[path][name].[hash].[ext]',
// 'image-loader?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{
test: /\.pdf$/i,
loaders: [
'file-loader?context=' + rootAssetPath + '&name=[path][name].[ext]',
]
}
]
},
plugins: [
new ExtractTextPlugin('[name].[contenthash].css'),
new CopyWebpackPlugin([
'brigade/static/robots.txt'
]),
new ManifestRevisionPlugin(path.join('brigade', 'build', 'manifest.json'), {
rootAssetPath: rootAssetPath,
extensionsRegex: /\.js/,
})
]
};