1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-21 17:26:56 +01:00

chore: update wepback config

declare Buffer as webpack plugin
This commit is contained in:
getlarge 2022-02-15 08:06:05 +01:00
parent 1f95bec2be
commit 34289b0640
No known key found for this signature in database
GPG Key ID: E4E13243600F9566
5 changed files with 15 additions and 9 deletions

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0 // Code is Apache-2.0 and docs are CC-BY-4.0
import { Buffer } from 'buffer'
import stableStringify from 'json-stable-stringify' import stableStringify from 'json-stable-stringify'
import clone from 'clone' import clone from 'clone'
import base58 from 'bs58' import base58 from 'bs58'

View File

@ -6,7 +6,8 @@
'use strict' 'use strict'
const { paths } = require('./webpack.parts.js') const { ProvidePlugin } = require('webpack')
const { paths } = require('./webpack.parts')
module.exports = { module.exports = {
entry: paths.entry, entry: paths.entry,
@ -24,10 +25,18 @@ module.exports = {
}, },
optimization: { optimization: {
minimize: true, minimize: true,
noEmitOnErrors: true emitOnErrors: false
}, },
resolve: { resolve: {
extensions: ['.js'], extensions: ['.js'],
modules: ['node_modules'], modules: ['node_modules'],
}, fallback: {
buffer: require.resolve('buffer/'),
}
},
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
]
} }

View File

@ -8,9 +8,9 @@
const PRODUCTION = process.env.NODE_ENV === 'production' const PRODUCTION = process.env.NODE_ENV === 'production'
const common = require('./webpack.common.js') const common = require('./webpack.common')
const { outputs } = require('./webpack.parts.js') const { outputs } = require('./webpack.parts')
// '[libraryTarget]': [file extension] // '[libraryTarget]': [file extension]
const OUTPUT_MAPPING = { const OUTPUT_MAPPING = {

View File

@ -14,11 +14,9 @@ module.exports = {
minimizer: [ minimizer: [
new TerserPlugin({ new TerserPlugin({
test: /vendor/, test: /vendor/,
sourceMap: false
}), }),
new TerserPlugin({ new TerserPlugin({
test: /^((?!(vendor)).)*.js$/, test: /^((?!(vendor)).)*.js$/,
sourceMap: false
}) })
], ],
splitChunks: { splitChunks: {

View File

@ -9,8 +9,8 @@
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')
const production = require('./webpack.production.js') const production = require('./webpack.production')
const AddVendorsPlugin = require('./plugins/add-vendors-plugin') const AddVendorsPlugin = require('./plugins/add-vendors-plugin')