1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 09:46:58 +01:00

fix: update webpack config

This commit is contained in:
getlarge 2021-03-09 07:16:51 +01:00
parent b3909b0f04
commit ad7763f76c
No known key found for this signature in database
GPG Key ID: E4E13243600F9566
3 changed files with 27 additions and 26 deletions

View File

@ -18,9 +18,9 @@ module.exports = class AddVendorsPlugin {
const vendor = compilation.assets[`vendors.${this.base}`] const vendor = compilation.assets[`vendors.${this.base}`]
if (main && vendor) { if (main && vendor) {
const compiledAsset = new ConcatSource(main.children[0]) const compiledAsset = new ConcatSource(main._value[0])
compiledAsset.add(vendor) compiledAsset.add(vendor)
compiledAsset.add(main.children[1]) compiledAsset.add(main._value[1])
compilation.assets = {} compilation.assets = {}
compilation.assets[this.base] = compiledAsset compilation.assets[this.base] = compiledAsset
} else if (main && mainMap) { } else if (main && mainMap) {
@ -28,6 +28,7 @@ module.exports = class AddVendorsPlugin {
compilation.assets[this.base] = main compilation.assets[this.base] = main
compilation.assets[`${this.base}.map`] = mainMap compilation.assets[`${this.base}.map`] = mainMap
} }
callback() callback()
} }
) )

View File

@ -6,29 +6,29 @@
'use strict' 'use strict'
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin')
module.exports = { module.exports = {
devtool: 'inline-source-map', devtool: 'inline-source-map',
optimization: { optimization: {
minimizer: [ minimizer: [
new UglifyJsPlugin({ new TerserPlugin({
test: /vendor/, test: /vendor/,
sourceMap: false, sourceMap: false
}), }),
new UglifyJsPlugin({ new TerserPlugin({
test: /^((?!(vendor)).)*.js$/, test: /^((?!(vendor)).)*.js$/,
sourceMap: true, sourceMap: false
}) })
], ],
splitChunks: { splitChunks: {
cacheGroups: { cacheGroups: {
commons: { commons: {
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
name: 'vendors', name: 'vendors',
chunks: 'all' chunks: 'all'
} }
} }
}, }
}, }
} }

View File

@ -7,7 +7,7 @@
'use strict' 'use strict'
const path = require('path') const path = require('path')
const merge = require('webpack-merge') const { merge } = require('webpack-merge')
const development = require('./webpack.development.js') const development = require('./webpack.development.js')
const production = require('./webpack.production.js') const production = require('./webpack.production.js')