From 4a3b4cffcc4ac70184bc58381e1fe89179df7e00 Mon Sep 17 00:00:00 2001 From: getlarge Date: Tue, 15 Feb 2022 12:39:53 +0100 Subject: [PATCH] fix: update webpack config --- plugins/add-vendors-plugin.js | 8 ++------ scripts/hash_fingerprint_contents.js | 2 +- webpack.common.js | 2 +- webpack.config.js | 3 --- webpack.parts.js | 7 ++++--- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/add-vendors-plugin.js b/plugins/add-vendors-plugin.js index e2b560f7..bbcb610c 100644 --- a/plugins/add-vendors-plugin.js +++ b/plugins/add-vendors-plugin.js @@ -1,5 +1,3 @@ -const { ConcatSource } = require('webpack-sources') - module.exports = class AddVendorsPlugin { constructor (base) { this.base = base @@ -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 diff --git a/scripts/hash_fingerprint_contents.js b/scripts/hash_fingerprint_contents.js index ca34dda0..94fe2759 100644 --- a/scripts/hash_fingerprint_contents.js +++ b/scripts/hash_fingerprint_contents.js @@ -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') diff --git a/webpack.common.js b/webpack.common.js index 6e1fcb1e..162b718e 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -35,7 +35,7 @@ module.exports = { }, optimization: { minimize: true, - noEmitOnErrors: true + emitOnErrors: false }, resolve: { extensions: ['.js'], diff --git a/webpack.config.js b/webpack.config.js index 25955827..a4ae8346 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,9 +21,6 @@ const OVERRIDES = { // optimization: { // minimize: false // } - node: { - global: true - } } if (PRODUCTION) { diff --git a/webpack.parts.js b/webpack.parts.js index ccf59e2f..40a67bc9 100644 --- a/webpack.parts.js +++ b/webpack.parts.js @@ -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' @@ -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 },