Fall back to looking in node_modules folder in cwd

This commit is contained in:
Alex Dima 2020-03-10 10:11:59 +01:00
parent 849d676919
commit 2ea08783c2
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0

View file

@ -28,7 +28,11 @@ featuresArr.forEach(feature => featuresById[feature.label] = feature);
* Return a resolved path for a given Monaco file.
*/
function resolveMonacoPath(filePath: string): string {
return require.resolve(path.join(process.cwd(), 'node_modules', 'monaco-editor/esm', filePath));
try {
return require.resolve(path.join('monaco-editor/esm', filePath));
} catch(err) {
return require.resolve(path.join(process.cwd(), 'node_modules/monaco-editor/esm', filePath));
}
}
/**