mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
chore(NA): implement improvements on webpack config
This commit is contained in:
parent
b72028ce58
commit
141c9d47f6
1 changed files with 6 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
const Path = require('path');
|
||||
const Os = require('os');
|
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||
|
@ -14,7 +15,6 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||
|
||||
const CompressionPlugin = require('compression-webpack-plugin');
|
||||
const { REPO_ROOT } = require('@kbn/utils');
|
||||
const webpack = require('webpack');
|
||||
const { RawSource } = require('webpack-sources');
|
||||
|
||||
const UiSharedDeps = require('./src/index');
|
||||
|
@ -31,7 +31,8 @@ module.exports = {
|
|||
'kbn-ui-shared-deps.v8.light': ['@elastic/eui/dist/eui_theme_amsterdam_light.css'],
|
||||
},
|
||||
context: __dirname,
|
||||
devtool: '#cheap-source-map',
|
||||
//
|
||||
devtool: 'cheap-source-map',
|
||||
output: {
|
||||
path: UiSharedDeps.distDir,
|
||||
filename: '[name].js',
|
||||
|
@ -39,6 +40,7 @@ module.exports = {
|
|||
devtoolModuleFilenameTemplate: (info) =>
|
||||
`kbn-ui-shared-deps/${Path.relative(REPO_ROOT, info.absoluteResourcePath)}`,
|
||||
library: '__kbnSharedDeps__',
|
||||
futureEmitAssets: true,
|
||||
},
|
||||
|
||||
module: {
|
||||
|
@ -110,6 +112,7 @@ module.exports = {
|
|||
optimization: {
|
||||
minimizer: [
|
||||
new CssMinimizerPlugin({
|
||||
parallel: Math.min(Os.cpus().length, 2),
|
||||
minimizerOptions: {
|
||||
preset: [
|
||||
'default',
|
||||
|
@ -123,7 +126,7 @@ module.exports = {
|
|||
cache: false,
|
||||
sourceMap: false,
|
||||
extractComments: false,
|
||||
parallel: false,
|
||||
parallel: Math.min(Os.cpus().length, 2),
|
||||
terserOptions: {
|
||||
compress: true,
|
||||
mangle: true,
|
||||
|
@ -154,9 +157,6 @@ module.exports = {
|
|||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': '"production"',
|
||||
}),
|
||||
new CompressionPlugin({
|
||||
algorithm: 'brotliCompress',
|
||||
filename: '[path].br',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue