Skip to content

Commit

Permalink
fix: update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Feb 15, 2022
1 parent 0852fc4 commit 4a3b4cf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
8 changes: 2 additions & 6 deletions plugins/add-vendors-plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { ConcatSource } = require('webpack-sources')

module.exports = class AddVendorsPlugin {
constructor (base) {
this.base = base
Expand All @@ -14,11 +12,9 @@ module.exports = class AddVendorsPlugin {
const vendor = compilation.assets[`vendors.${this.base}`]

if (main && vendor) {
const compiledAsset = new ConcatSource(main._value[0])
compiledAsset.add(vendor)
compiledAsset.add(main._value[1])
main.add(vendor)
compilation.assets = {}
compilation.assets[this.base] = compiledAsset
compilation.assets[this.base] = main
} else if (main && mainMap) {
compilation.assets = {}
compilation.assets[this.base] = main
Expand Down
2 changes: 1 addition & 1 deletion scripts/hash_fingerprint_contents.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const base64url = require('../src/util/base64url')
const crypto = require('crypto')
const base64url = require('../src/util/base64url')

const fingerprintContents = Buffer.from(process.argv[2], 'base64')

Expand Down
2 changes: 1 addition & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
},
optimization: {
minimize: true,
noEmitOnErrors: true
emitOnErrors: false
},
resolve: {
extensions: ['.js'],
Expand Down
3 changes: 0 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ const OVERRIDES = {
// optimization: {
// minimize: false
// }
node: {
global: true
}
}

if (PRODUCTION) {
Expand Down
7 changes: 4 additions & 3 deletions webpack.parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const production = require('./webpack.production.js')
const AddVendorsPlugin = require('./plugins/add-vendors-plugin')

const paths = {
entry: path.resolve(__dirname, './src/index.js'),
entry: path.resolve(__dirname, 'src/index.js'),
bundle: path.resolve(__dirname, 'dist/browser')
}

const outputs = (base, env, mapping, overrides) => {
const collection = []
const library = 'CryptoConditions'
const windowLibrary = 'CryptoConditions'
// const windowLibrary = 'CryptoConditions'

const environment = env === 'production' ? production : development
const ext = env === 'production' ? 'min.js' : 'js'
Expand All @@ -29,7 +29,8 @@ const outputs = (base, env, mapping, overrides) => {
const compiled = {
output: {
filename: filename,
library: target === 'window' ? windowLibrary : library,
// setting library mess up with export
// library: target === 'window' ? windowLibrary : library,
libraryTarget: target,
path: paths.bundle
},
Expand Down

0 comments on commit 4a3b4cf

Please sign in to comment.