Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 58da6e5

Browse files
committed
Remove a try/catch block
1 parent 7734f5c commit 58da6e5

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

plugins/PlatformFSPlugin.ts

+15-19
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,21 @@ export function mapFileSystem(args: MapFileSystemArgs): any {
101101
const {dir, name, ext} = parseFile(file);
102102
let platformFilePath = join(dir, `${name}.${platform}${ext}`);
103103

104-
try {
105-
require.resolve(platformFilePath);
106-
} catch (e) {
107-
if (isExternal && dir.indexOf("/@nativescript/core/") !== -1) {
108-
let replacedPath;
109-
try {
110-
replacedPath = dir.replace(
111-
/node_modules(\/[^/]+)?\/@nativescript\/core/,
112-
`node_modules/nativescript-platform-${platform}`
113-
);
114-
115-
platformFilePath = require.resolve(join(replacedPath, `${name}.${platform}${ext}`));
116-
} catch (e) {
117-
if (replacedPath) {
118-
if (ext === ".d") {
119-
platformFilePath = undefined;
120-
} else {
121-
platformFilePath = join(replacedPath, `${name}${ext}`);
122-
}
104+
if (isExternal && dir.indexOf("/@nativescript/core/") !== -1) {
105+
let replacedPath;
106+
try {
107+
replacedPath = dir.replace(
108+
/node_modules(\/[^/]+)?\/@nativescript\/core/,
109+
`node_modules/nativescript-platform-${platform}`
110+
);
111+
112+
platformFilePath = require.resolve(join(replacedPath, `${name}.${platform}${ext}`));
113+
} catch (e) {
114+
if (replacedPath) {
115+
if (ext === ".d") {
116+
platformFilePath = undefined;
117+
} else {
118+
platformFilePath = join(replacedPath, `${name}${ext}`);
123119
}
124120
}
125121
}

0 commit comments

Comments
 (0)