UNPKG

@nx/vite

Version:

The Nx Plugin for building and testing applications using Vite

28 lines (27 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "findFile", { enumerable: true, get: function() { return findFile; } }); const _nodefs = require("node:fs"); const _nodepath = require("node:path"); function findFile(path, extensions, existsSyncImpl = _nodefs.existsSync) { const queryLessPath = path.replace(/\?\S*$/, ''); for (const ext of extensions){ const dir = (0, _nodepath.dirname)(path); // Support file extensions such as .css and .js in the import path. // While still allowing for '.suffix' const name = (0, _nodepath.basename)(queryLessPath, ext); const resolvedPath = (0, _nodepath.resolve)(dir, name + ext); if (existsSyncImpl(resolvedPath)) { return resolvedPath; } const resolvedIndexPath = (0, _nodepath.resolve)(path, `index${ext}`); if (existsSyncImpl(resolvedIndexPath)) { return resolvedIndexPath; } } } //# sourceMappingURL=nx-tsconfig-paths-find-file.js.map