@@ -15,6 +15,8 @@ var SingleEntryDependency = require('webpack/lib/dependencies/SingleEntryDepende
1515var blocked = [ ]
1616var isBlocked = false
1717
18+ const normalize = ( file ) => file . replace ( / \\ / g, '/' )
19+
1820var escapeRegExp = function ( str ) {
1921 // See details here https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
2022 return str . replace ( / [ - [ \] / { } ( ) * + ? . \\ ^ $ | ] / g, '\\$&' )
@@ -208,7 +210,7 @@ Plugin.prototype.make = function(compilation, callback) {
208210
209211 var dep = new SingleEntryDependency ( entry )
210212
211- var filename = path . relative ( this . basePath , file ) . replace ( / \\ / g , '/' )
213+ var filename = normalize ( path . relative ( this . basePath , file ) )
212214 var name = path . join ( path . dirname ( filename ) , path . basename ( filename , path . extname ( filename ) ) )
213215
214216 this . entries [ name ] = filename
@@ -231,7 +233,7 @@ Plugin.prototype.make = function(compilation, callback) {
231233Plugin . prototype . readFile = function ( file , callback ) {
232234 var middleware = this . middleware
233235 var optionsCount = this . optionsCount
234-
236+ file = normalize ( file )
235237 var doRead = function ( ) {
236238 if ( optionsCount > 1 ) {
237239 async . times ( optionsCount , function ( idx , callback ) {
@@ -294,7 +296,7 @@ function createPreprocesor(/* config.basePath */ basePath, webpackPlugin) {
294296 throw err
295297 }
296298
297- var outputPath = webpackPlugin . outputs [ filename ]
299+ var outputPath = webpackPlugin . outputs [ normalize ( filename ) ]
298300 file . path = path . join ( basePath , outputPath )
299301
300302 done ( err , content && content . toString ( ) )
@@ -316,4 +318,4 @@ module.exports = {
316318 webpackPlugin : [ 'type' , Plugin ] ,
317319 'preprocessor:webpack' : [ 'factory' , createPreprocesor ] ,
318320 'middleware:webpackBlocker' : [ 'factory' , createWebpackBlocker ]
319- }
321+ }
0 commit comments