-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.deploy.js
60 lines (55 loc) · 1.63 KB
/
webpack.deploy.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
/*
* Copyright (c) 2017, Hugo Freire <[email protected]>.
*
* This source code is licensed under the license found in the
* LICENSE.md file in the root directory of this source tree.
*/
const AWS_REGION = process.env.AWS_REGION
const AWS_S3_BUCKET = process.env.AWS_S3_BUCKET || 'antifragile.systems'
const AWS_CLOUDFRONT_DISTRIBUTION_ID = process.env.AWS_CLOUDFRONT_DISTRIBUTION_ID
const webpackMerge = require('webpack-merge')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const S3Plugin = require('webpack-s3-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const commonConfig = require('./webpack.config')
const extractSassPlugin = new ExtractTextPlugin({ filename: 'assets/styles/[name].[contenthash:8].css' })
module.exports = webpackMerge(commonConfig, {
module: {
rules: [
{
test: /\.scss$/,
use: extractSassPlugin.extract({
use: [ 'css-loader', 'sass-loader' ],
fallback: 'style-loader',
publicPath: '/'
})
},
]
},
plugins: [
extractSassPlugin,
new FaviconsWebpackPlugin({
title: 'Antifragile Systems',
logo: './src/assets/images/logo.svg',
prefix: 'assets/icons/logo.[hash:8].svg/',
persistentCache: true,
icons: {
opengraph: true,
twitter: true,
windows: true
}
}),
new S3Plugin({
s3Options: {
region: AWS_REGION
},
s3UploadOptions: {
Bucket: AWS_S3_BUCKET
},
cloudfrontInvalidateOptions: {
DistributionId: AWS_CLOUDFRONT_DISTRIBUTION_ID,
Items: [ '/*' ]
}
})
],
})