File tree 3 files changed +27
-15
lines changed
3 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 1
1
var path = require ( 'path' ) ;
2
2
var fse = require ( 'fs-extra' ) ;
3
3
var _ = require ( 'lodash' ) ;
4
- var mutexify = require ( 'mutexify' ) ;
5
-
6
- var lock = mutexify ( ) ;
7
4
8
5
function ManifestPlugin ( opts ) {
9
6
this . opts = _ . assign ( {
@@ -145,23 +142,23 @@ ManifestPlugin.prototype.apply = function(compiler) {
145
142
146
143
var json = JSON . stringify ( manifest , null , 2 ) ;
147
144
145
+ compilation . assets [ outputName ] = {
146
+ source : function ( ) {
147
+ return json ;
148
+ } ,
149
+ size : function ( ) {
150
+ return json . length ;
151
+ }
152
+ } ;
153
+
148
154
var outputFolder = compilation . options . output . path ;
149
155
var outputFile = path . resolve ( compilation . options . output . path , this . opts . fileName ) ;
150
156
151
157
if ( this . opts . writeToFileEmit ) {
152
158
fse . outputFileSync ( outputFile , json ) ;
153
159
}
154
160
155
- compiler . outputFileSystem . mkdirp ( path . dirname ( outputFile ) , function ( err ) {
156
- if ( err ) return compileCallback ( err ) ;
157
-
158
- lock ( function ( release ) {
159
- compiler . outputFileSystem . writeFile ( outputFile , json , function ( err ) {
160
- release ( ) ;
161
- compileCallback ( err ) ;
162
- } ) ;
163
- } ) ;
164
- } ) ;
161
+ compileCallback ( ) ;
165
162
} . bind ( this ) ) ;
166
163
} ;
167
164
Original file line number Diff line number Diff line change 40
40
"homepage" : " https://github.com/danethurber/webpack-manifest-plugin" ,
41
41
"dependencies" : {
42
42
"fs-extra" : " ^0.30.0" ,
43
- "lodash" : " >=3.5 <5" ,
44
- "mutexify" : " ^1.1.0"
43
+ "lodash" : " >=3.5 <5"
45
44
},
46
45
"nyc" : {
47
46
"reporter" : [
Original file line number Diff line number Diff line change @@ -407,6 +407,22 @@ describe('ManifestPlugin', function() {
407
407
} ) ;
408
408
} ) ;
409
409
410
+ it ( 'make manifest available to other webpack plugins' , function ( done ) {
411
+ webpackCompile ( {
412
+ context : __dirname ,
413
+ entry : './fixtures/file.js'
414
+ } , { } , function ( manifest , stats ) {
415
+ expect ( manifest ) . toEqual ( {
416
+ 'main.js' : 'main.js'
417
+ } ) ;
418
+
419
+ expect ( JSON . parse ( stats . compilation . assets [ 'manifest.json' ] . source ( ) ) ) . toEqual ( {
420
+ 'main.js' : 'main.js'
421
+ } ) ;
422
+
423
+ done ( ) ;
424
+ } ) ;
425
+ } ) ;
410
426
} ) ;
411
427
412
428
describe ( 'with ExtractTextPlugin' , function ( ) {
You can’t perform that action at this time.
0 commit comments