@@ -58,6 +58,7 @@ function VirtualModulesPlugin(compiler) {
58
58
const segments = file . split ( / [ \\ / ] / ) ;
59
59
let count = segments . length - 1 ;
60
60
const minCount = segments [ 0 ] ? 1 : 0 ;
61
+ // create directories for each segment (to prevent files not being in a directory)
61
62
while ( count > minCount ) {
62
63
const dir = segments . slice ( 0 , count ) . join ( path . sep ) || path . sep ;
63
64
try {
@@ -123,7 +124,7 @@ VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) {
123
124
const stats = new VirtualStats ( {
124
125
dev : 8675309 ,
125
126
ino : inode ++ ,
126
- mode : 33188 ,
127
+ mode : 16877 ,
127
128
nlink : 0 ,
128
129
uid : 1000 ,
129
130
gid : 1000 ,
@@ -175,17 +176,11 @@ VirtualModulesPlugin.prototype.writeModule = function(filePath, contents) {
175
176
} ;
176
177
177
178
function getData ( storage , key ) {
178
- // Webpack 5
179
- if ( storage . _data instanceof Map ) {
180
- return storage . _data . get ( key ) ;
181
- } else if ( storage . _data ) {
182
- return storage . data [ key ] ;
183
- } else if ( storage . data instanceof Map ) {
184
- // Webpack v4
179
+ const data = storage . _data /* webpack 5 */ || storage . data /* webpack 4 */ ;
180
+ if ( data instanceof Map ) {
185
181
return storage . data . get ( key ) ;
186
- } else {
187
- return storage . data [ key ] ;
188
182
}
183
+ return data . data [ key ] ;
189
184
}
190
185
191
186
function setData ( backendOrStorage , key , valueFactory ) {
0 commit comments