-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.prod.js
56 lines (54 loc) · 1.57 KB
/
webpack.prod.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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const common = require('./webpack.common');
const merge = require('webpack-merge');
module.exports = merge(common, {
mode: 'production',
devtool: 'none',
output: {
filename: 'main.[contentHash:8].js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new ManifestPlugin(),
new MiniCssExtractPlugin({filename: '[name].[contentHash:8].css'}),
new webpack.LoaderOptionsPlugin({
options: {
handlebarsLoader: {}
}
}),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
favicon: './src/assets/favicon.ico',
template: './src/index.handlebars',
templateParameters:require('./src/data.json'),
meta: {
MobileOptimized: 'width',
HandheldFriendly: 'true',
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'
}
}),
new ImageminPlugin({}),
new CopyWebpackPlugin([
{ from: 'src/assets/carnation-custom-700.jpg', to: 'og_image.jpg' },
]),
],
module: {
rules: [
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
}
]
}
});