MDL-66307 js: fix path handling on Windows

This commit is contained in:
Tim Hunt 2019-08-01 14:54:05 +01:00
parent 2c28ba8888
commit ac1a91bf47

View File

@ -36,6 +36,7 @@
module.exports = ({ template, types }) => {
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const cwd = process.cwd();
@ -92,7 +93,7 @@ module.exports = ({ template, types }) => {
*/
function getModuleNameFromFileName(searchFileName) {
searchFileName = fs.realpathSync(searchFileName);
const relativeFileName = searchFileName.replace(`${cwd}/`, '');
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
const [componentPath, file] = relativeFileName.split('/amd/src/');
const fileName = file.replace('.js', '');