forked from nrwl/webpack-plugin-critical
-
Notifications
You must be signed in to change notification settings - Fork 38
/
webpack.config.js
43 lines (34 loc) · 849 Bytes
/
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
const HtmlWebpackCriticalPlugin = require('./src/index');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const OUTPUT_DIR = path.resolve(__dirname, 'build');
module.exports = {
mode: 'production',
entry: {
index: './test/cases/generate-critical-css/index.js'
},
output: {
path: OUTPUT_DIR,
filename: 'html-crtitical-webpack-plugin.[contenthash].js'
},
module: {
rules: [{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
}]
},
plugins: [
new HtmlWebpackPlugin(),
new MiniCssExtractPlugin(),
new HtmlWebpackCriticalPlugin({
base: OUTPUT_DIR,
src: 'index.html',
dest: 'index.html',
inline: true
})
]
};