Normalize path separators when writing test entry file (#15473)

This commit is contained in:
Kim Joar Bekkelund 2017-12-07 18:32:35 +01:00 committed by GitHub
parent 67ae44bddb
commit cfca462c2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,11 @@
import { fromNode as fcb } from 'bluebird';
import { readFile, writeFile, unlink, stat } from 'fs';
// We normalize all path separators to `/` in generated files
function normalizePath(path) {
return path.replace(/[\\\/]+/g, '/');
}
export class UiBundle {
constructor(options) {
const {
@ -34,7 +39,7 @@ export class UiBundle {
getRequires() {
return this._modules.map(module => (
`require('${module}');`
`require('${normalizePath(module)}');`
));
}