-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.landing.config.js
55 lines (52 loc) · 1.84 KB
/
webpack.landing.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
//this extra config file exists because i couldn't find how to bundle landing into a single file (without depending on chunks) while using chunk splitting in webpack.production.config.js
import path from 'path';
import webpack from 'webpack';
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import ReplaceHashPlugin from './ReplaceHashPlugin.js';
import InlineStylePlugin from './InlineStylePlugin.js';
export default {
mode: 'production',
entry: {
landing: './loader/production/landing.bundle.js',
style: ['./src/Client/css/base.css', './src/Client/css/external.css', './src/Client/css/landing.css']
},
output: {
path: path.resolve('.', 'file/bundle'),
filename: '[name].[contenthash].bundle.js'
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new webpack.DefinePlugin({
'process.env.PRODUCTION': true
}),
new ReplaceHashPlugin({ files: [{ dir: 'file/bundle', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }),
new InlineStylePlugin({ files: [{styleFile: 'file/bundle/style.css', htmlFile: 'output-es/Server.Landing.Template/index.js'} ]})
],
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
}
}
]
}
]
},
optimization: {
removeEmptyChunks: true,
minimizer: [
new TerserPlugin(),
new CssMinimizerPlugin(),
]
},
};