-
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(loader): pass
emitFile
to the child compilation (`loaderContext…
….emitFile`) (#177)
- Loading branch information
1 parent
5304463
commit 18c066e
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import path from 'path'; | ||
|
||
import MemoryFS from 'memory-fs'; | ||
import webpack from 'webpack'; | ||
|
||
const assetsNames = (json) => json.assets.map((asset) => asset.name); | ||
|
||
describe('TestMemoryFS', () => { | ||
it('should preserve asset even if not emitted', (done) => { | ||
const casesDirectory = path.resolve(__dirname, 'cases'); | ||
const directoryForCase = path.resolve(casesDirectory, 'simple-publicpath'); | ||
const webpackConfig = require(path.resolve( | ||
directoryForCase, | ||
'webpack.config.js' | ||
)); | ||
const compiler = webpack({ | ||
...webpackConfig, | ||
mode: 'development', | ||
context: directoryForCase, | ||
}); | ||
compiler.outputFileSystem = new MemoryFS(); | ||
compiler.run((err1, stats1) => { | ||
if (err1) { | ||
done(err1); | ||
return; | ||
} | ||
compiler.run((err2, stats2) => { | ||
if (err2) { | ||
done(err2); | ||
return; | ||
} | ||
expect(assetsNames(stats1.toJson())).toEqual( | ||
assetsNames(stats2.toJson()) | ||
); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |