From 2ea08783c2c4ee159c7cdcd744d531540f8a2fe0 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 10 Mar 2020 10:11:59 +0100 Subject: [PATCH] Fall back to looking in node_modules folder in cwd --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 07fa2e8f..38690d65 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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)); + } } /**