From 220f828a9115b205e795e5dbd338b0e74207d66d Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Wed, 4 Nov 2020 20:39:42 +0300 Subject: [PATCH 1/2] fix: serializing big strings --- src/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index 73550866..4c273f6c 100644 --- a/src/loader.js +++ b/src/loader.js @@ -225,7 +225,7 @@ export function pitch(request) { return { identifier: module.identifier(), context: module.context, - content, + content: Buffer.from(content), media, sourceMap, }; From 57f91cc6a5040aa8b434727072f6a8df7aca6d63 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 5 Nov 2020 20:06:17 +0300 Subject: [PATCH 2/2] fix: code --- src/index.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index b00b060d..6039de07 100644 --- a/src/index.js +++ b/src/index.js @@ -659,11 +659,11 @@ class MiniCssExtractPlugin { const externalsSource = new ConcatSource(); for (const m of usedModules) { - if (/^@import url/.test(m.content)) { + let content = m.content.toString(); + + if (/^@import url/.test(content)) { // HACK for IE // http://stackoverflow.com/a/14676665/1458162 - let { content } = m; - if (m.media) { // insert media into the @import // this is rar @@ -681,17 +681,14 @@ class MiniCssExtractPlugin { if (m.sourceMap) { source.add( new SourceMapSource( - m.content, + content, m.readableIdentifier(requestShortener), m.sourceMap ) ); } else { source.add( - new OriginalSource( - m.content, - m.readableIdentifier(requestShortener) - ) + new OriginalSource(content, m.readableIdentifier(requestShortener)) ); } source.add('\n');