-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.config.js
43 lines (38 loc) · 1.26 KB
/
webpack.build.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
const autoprefixer = require('autoprefixer')
const path = require('path')
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin')
const webpack = require('webpack')
const Routes = require('./StaticRoutes.js')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const commonLoaders = require('./webpack/commonLoaders')
const createStylesheetLoaders = require('./webpack/createStylesheetLoaders')
module.exports = {
entry: {
prerender: './src/prerender.js'
},
output: {
publicPath: '/',
path: path.join(__dirname, '/public/'),
filename: 'assets/javascripts/bundle-[chunkhash].js',
libraryTarget: 'umd'
},
module: {
loaders: [
...commonLoaders,
...createStylesheetLoaders(createStylesheetLoaders.modes.production)
]
},
postcss: [autoprefixer({browsers: ['last 4 versions']})],
plugins: [
new ExtractTextPlugin('assets/stylesheets/style-[contenthash].css'),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.DedupePlugin(),
new StaticSiteGeneratorPlugin('prerender', Routes.paths, Routes),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
})
]
}