Skip to content

Commit

Permalink
fix: serializing big strings (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Nov 6, 2020
1 parent 36454c3 commit 022d945
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export function pitch(request) {
return {
identifier: module.identifier(),
context: module.context,
content,
content: Buffer.from(content),
media,
sourceMap,
};
Expand Down

0 comments on commit 022d945

Please sign in to comment.