Skip to content

Commit 022d945

Browse files
fix: serializing big strings (#647)
1 parent 36454c3 commit 022d945

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/index.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,11 @@ class MiniCssExtractPlugin {
659659
const externalsSource = new ConcatSource();
660660

661661
for (const m of usedModules) {
662-
if (/^@import url/.test(m.content)) {
662+
let content = m.content.toString();
663+
664+
if (/^@import url/.test(content)) {
663665
// HACK for IE
664666
// http://stackoverflow.com/a/14676665/1458162
665-
let { content } = m;
666-
667667
if (m.media) {
668668
// insert media into the @import
669669
// this is rar
@@ -681,17 +681,14 @@ class MiniCssExtractPlugin {
681681
if (m.sourceMap) {
682682
source.add(
683683
new SourceMapSource(
684-
m.content,
684+
content,
685685
m.readableIdentifier(requestShortener),
686686
m.sourceMap
687687
)
688688
);
689689
} else {
690690
source.add(
691-
new OriginalSource(
692-
m.content,
693-
m.readableIdentifier(requestShortener)
694-
)
691+
new OriginalSource(content, m.readableIdentifier(requestShortener))
695692
);
696693
}
697694
source.add('\n');

src/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export function pitch(request) {
225225
return {
226226
identifier: module.identifier(),
227227
context: module.context,
228-
content,
228+
content: Buffer.from(content),
229229
media,
230230
sourceMap,
231231
};

0 commit comments

Comments
 (0)