vite-plugin-simple-tsconfig-alias 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -24,11 +24,6 @@ function readTsconfig(filePath) {
|
|
|
24
24
|
if (read.error) return null;
|
|
25
25
|
return ts.parseJsonConfigFileContent(read.config, ts.sys, path.dirname(filePath), void 0, filePath);
|
|
26
26
|
}
|
|
27
|
-
function toArray(value) {
|
|
28
|
-
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
29
|
-
if (typeof value === "string") return [value];
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
27
|
function parseTsconfigAliases(projectRoot, configNames) {
|
|
33
28
|
const aliases = [];
|
|
34
29
|
for (const configName of configNames) {
|
|
@@ -37,8 +32,7 @@ function parseTsconfigAliases(projectRoot, configNames) {
|
|
|
37
32
|
if (!parsed) continue;
|
|
38
33
|
const baseUrl = parsed.options.baseUrl ?? path.dirname(configPath);
|
|
39
34
|
const paths = parsed.options.paths ?? {};
|
|
40
|
-
for (const [from,
|
|
41
|
-
const firstTarget = toArray(to)[0];
|
|
35
|
+
for (const [from, [firstTarget]] of Object.entries(paths)) {
|
|
42
36
|
if (!firstTarget) continue;
|
|
43
37
|
const absoluteTarget = path.resolve(baseUrl, firstTarget);
|
|
44
38
|
if (!from.includes("*")) {
|