Skip to content

Commit 81ab6c8

Browse files
authored
Merge pull request #20 from NirBenya/master
[FEAT] allow extracting css with ExtractTextPlugin (#18)
2 parents 24bf921 + ecb5500 commit 81ab6c8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ async function prerender (parentCompilation, request, options, inject, loader) {
100100
filename: FILENAME
101101
};
102102

103-
// Only copy over mini-extract-text-plugin (excluding it breaks extraction entirely)
104-
const plugins = (parentCompiler.options.plugins || []).filter(c => /MiniCssExtractPlugin/i.test(c.constructor.name));
103+
// Only copy over allowed plugins (excluding them breaks extraction entirely).
104+
const allowedPlugins = ['MiniCssExtractPlugin', 'ExtractTextPlugin'];
105+
const plugins = (parentCompiler.options.plugins || []).filter(c => allowedPlugins.includes(c.constructor.name));
105106

106107
// Compile to an in-memory filesystem since we just want the resulting bundled code as a string
107108
const compiler = parentCompilation.createChildCompiler('prerender', outputOptions, plugins);

0 commit comments

Comments
 (0)