Skip to content

Commit

Permalink
chore: update wepback config
Browse files Browse the repository at this point in the history
declare Buffer as webpack plugin
  • Loading branch information
getlarge committed Feb 15, 2022
1 parent 1f95bec commit 34289b0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: (Apache-2.0 AND 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 clone from 'clone'
import base58 from 'bs58'
Expand Down
13 changes: 11 additions & 2 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

'use strict'

const { paths } = require('./webpack.parts.js')
const { ProvidePlugin } = require('webpack')
const { paths } = require('./webpack.parts')

module.exports = {
entry: paths.entry,
Expand All @@ -24,10 +25,18 @@ module.exports = {
},
optimization: {
minimize: true,
noEmitOnErrors: true
emitOnErrors: false
},
resolve: {
extensions: ['.js'],
modules: ['node_modules'],
fallback: {
buffer: require.resolve('buffer/'),
}
},
plugins: [
new ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
]
}
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

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]
const OUTPUT_MAPPING = {
Expand Down
2 changes: 0 additions & 2 deletions webpack.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ module.exports = {
minimizer: [
new TerserPlugin({
test: /vendor/,
sourceMap: false
}),
new TerserPlugin({
test: /^((?!(vendor)).)*.js$/,
sourceMap: false
})
],
splitChunks: {
Expand Down
4 changes: 2 additions & 2 deletions webpack.parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
const path = require('path')
const { merge } = require('webpack-merge')

const development = require('./webpack.development.js')
const production = require('./webpack.production.js')
const development = require('./webpack.development')
const production = require('./webpack.production')

const AddVendorsPlugin = require('./plugins/add-vendors-plugin')

Expand Down

0 comments on commit 34289b0

Please sign in to comment.