This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dll.js
84 lines (77 loc) · 2.22 KB
/
webpack.dll.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2019. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
/* Copyright (c) 2020 Red Hat, Inc. */
/* Copyright Contributors to the Open Cluster Management project */
const path = require('path'),
webpack = require('webpack'),
AssetsPlugin = require('assets-webpack-plugin'),
CompressionPlugin = require('compression-webpack-plugin')
const PRODUCTION = process.env.BUILD_ENV ? /production/.test(process.env.BUILD_ENV) : false
process.env.BABEL_ENV = process.env.BABEL_ENV ? process.env.BABEL_ENV : 'client'
module.exports = {
entry: {
'vendorhcm': [
'@loadable/component',
'lodash',
'moment',
'normalizr',
'prop-types',
'react-dom',
'react-dom/server',
'react-redux',
'react-router-dom',
'react',
'redux-logger',
'redux-thunk',
'redux',
'reselect'
]
},
module: {
rules: [
{
test: /\.css$/,
include: path.resolve(__dirname, './node_modules/monaco-editor'),
use: [{ loader: 'style-loader', options: { base: 2000 } },
'css-loader',],
},
],
},
output: {
path: __dirname + '/public',
filename: PRODUCTION ? 'dll.[name].[contenthash].min.js' : 'dll.[name].js',
library: '[name]'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(PRODUCTION ? 'production' : 'development')
}
}),
new webpack.DllPlugin({
path: path.join(__dirname, 'dll', '[name]-manifest.json'),
name: '[name]',
context: __dirname
}),
new CompressionPlugin({
filename: '[path][base].gz',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/
}),
new AssetsPlugin({
path: path.join(__dirname, 'public'),
fullPath: false,
prettyPrint: true,
update: true
}),
],
resolve: {
modules: [path.join(__dirname, 'node_modules')]
}
}