File tree 3 files changed +41
-0
lines changed
3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ class MiniCssExtractPlugin {
146
146
) } `
147
147
) ;
148
148
}
149
+
149
150
const identifierCountMap = new Map ( ) ;
150
151
for ( const line of content ) {
151
152
const count = identifierCountMap . get ( line . identifier ) || 0 ;
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export function pitch(request) {
59
59
compilation . hooks . normalModuleLoader . tap (
60
60
`${ pluginName } loader` ,
61
61
( loaderContext , module ) => {
62
+ loaderContext . emitFile = this . emitFile ;
62
63
loaderContext [ MODULE_TYPE ] = false ; // eslint-disable-line no-param-reassign
63
64
if ( module . request === request ) {
64
65
// eslint-disable-next-line no-param-reassign
Original file line number Diff line number Diff line change
1
+ import path from 'path' ;
2
+
3
+ import MemoryFS from 'memory-fs' ;
4
+ import webpack from 'webpack' ;
5
+
6
+ const assetsNames = ( json ) => json . assets . map ( ( asset ) => asset . name ) ;
7
+
8
+ describe ( 'TestMemoryFS' , ( ) => {
9
+ it ( 'should preserve asset even if not emitted' , ( done ) => {
10
+ const casesDirectory = path . resolve ( __dirname , 'cases' ) ;
11
+ const directoryForCase = path . resolve ( casesDirectory , 'simple-publicpath' ) ;
12
+ const webpackConfig = require ( path . resolve (
13
+ directoryForCase ,
14
+ 'webpack.config.js'
15
+ ) ) ;
16
+ const compiler = webpack ( {
17
+ ...webpackConfig ,
18
+ mode : 'development' ,
19
+ context : directoryForCase ,
20
+ } ) ;
21
+ compiler . outputFileSystem = new MemoryFS ( ) ;
22
+ compiler . run ( ( err1 , stats1 ) => {
23
+ if ( err1 ) {
24
+ done ( err1 ) ;
25
+ return ;
26
+ }
27
+ compiler . run ( ( err2 , stats2 ) => {
28
+ if ( err2 ) {
29
+ done ( err2 ) ;
30
+ return ;
31
+ }
32
+ expect ( assetsNames ( stats1 . toJson ( ) ) ) . toEqual (
33
+ assetsNames ( stats2 . toJson ( ) )
34
+ ) ;
35
+ done ( ) ;
36
+ } ) ;
37
+ } ) ;
38
+ } ) ;
39
+ } ) ;
You can’t perform that action at this time.
0 commit comments