From 4e08cf38797c2a1136905077fe11423e9ac24bca Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Wed, 27 May 2020 16:56:08 +0200 Subject: [PATCH] Fix flash from url (broken in 1.5.92) Changelog-entry: Fix flash from url (broken in 1.5.92) Change-type: patch --- webpack.config.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/webpack.config.ts b/webpack.config.ts index da3cea5f..67561937 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -24,7 +24,7 @@ import outdent from 'outdent'; import * as path from 'path'; import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin'; import * as TerserPlugin from 'terser-webpack-plugin'; -import { BannerPlugin } from 'webpack'; +import { BannerPlugin, NormalModuleReplacementPlugin } from 'webpack'; /** * Don't webpack package.json as mixpanel & sentry tokens @@ -125,6 +125,11 @@ const commonConfig = { test: /\.tsx?$/, use: 'ts-loader', }, + // force axios to use http backend (not xhr) to support streams + replace(/node_modules\/axios\/lib\/defaults\.js$/, { + search: './adapters/xhr', + replace: './adapters/http', + }), // remove bindings magic from drivelist replace( /node_modules\/drivelist\/js\/index\.js$/, @@ -210,6 +215,12 @@ const commonConfig = { new SimpleProgressWebpackPlugin({ format: process.env.WEBPACK_PROGRESS || 'verbose', }), + // Force axios to use http.js, not xhr.js as we need stream support + // (it's package.json file replaces http with xhr for browser targets). + new NormalModuleReplacementPlugin( + /node_modules\/axios\/lib\/adapters\/xhr\.js/, + './http.js', + ), ], output: { path: path.join(__dirname, 'generated'),