Merge pull request #105 from KevLeong/fix/monaco_path

fix: monaco path by cwd
This commit is contained in:
Alexandru Dima 2020-03-10 10:13:09 +01:00 committed by GitHub
commit 0c36fc7eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,11 @@ featuresArr.forEach(feature => featuresById[feature.label] = feature);
* Return a resolved path for a given Monaco file. * Return a resolved path for a given Monaco file.
*/ */
function resolveMonacoPath(filePath: string): string { function resolveMonacoPath(filePath: string): string {
return require.resolve(path.join('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));
}
} }
/** /**