Skip to content

Commit a79f0d4

Browse files
committed
Fix: yaml.load switch from fs.readfile to xhr if window is in global env, and that not what we want
1 parent 7949590 commit a79f0d4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

loadSync.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function _import (file) {
100100
// How do we handle file by type
101101
const mapping = {
102102
'.json': fs.readJsonSync,
103-
'.yml' : yaml.load.bind(yaml),
103+
'.yml' : _loadYml,
104104
'.js' : require,
105105
'.node': require
106106
};
@@ -118,6 +118,10 @@ function _import (file) {
118118
return result;
119119
}
120120

121+
function _loadYml(file){
122+
return yaml.parse(fs.readFileSync(file, {encoding:'utf8'}));
123+
}
124+
121125
function importCircularReferenceException (importedYamlFile, yamlFile) {
122126
let err = new Error(`Circular reference detected importing ${importedYamlFile} in ${yamlFile}`);
123127
err.name = 'importCircularReferenceException';

0 commit comments

Comments
 (0)