From 65aaa991707718fd497292815e4105e91c8adba3 Mon Sep 17 00:00:00 2001 From: chisdiva <47031061+chisdiva@users.noreply.github.com> Date: Thu, 7 Mar 2024 10:00:07 +0800 Subject: [PATCH] fix: alias incorrect on windows (#639) * fix: alias incorrect on windows * chore: version and changelog --------- Co-authored-by: luhc228 --- packages/pkg/CHANGELOG.md | 6 ++++++ packages/pkg/package.json | 2 +- packages/pkg/src/rollupPlugins/alias.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/pkg/CHANGELOG.md b/packages/pkg/CHANGELOG.md index 93ae1b73..eb58e524 100644 --- a/packages/pkg/CHANGELOG.md +++ b/packages/pkg/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.5.20 + +### Patch Changes + +- fix: alias path is incorrect on windows system + ## 1.5.19 ### Patch Changes diff --git a/packages/pkg/package.json b/packages/pkg/package.json index 8159feb5..ea757c10 100644 --- a/packages/pkg/package.json +++ b/packages/pkg/package.json @@ -1,6 +1,6 @@ { "name": "@ice/pkg", - "version": "1.5.19", + "version": "1.5.20", "description": "A fast builder for React components, Node modules and web libraries.", "type": "module", "main": "./lib/index.js", diff --git a/packages/pkg/src/rollupPlugins/alias.ts b/packages/pkg/src/rollupPlugins/alias.ts index 01791253..9d8812f7 100644 --- a/packages/pkg/src/rollupPlugins/alias.ts +++ b/packages/pkg/src/rollupPlugins/alias.ts @@ -69,7 +69,7 @@ export function resolveAliasConfig(alias: Record, rootDir: strin const target = alias[pattern]; newAlias[pattern] = target[0] === '.' ? // transform alias relative target to relative to the rootDir - path.relative(path.dirname(filePath), path.resolve(rootDir, target)) || '.' : + path.relative(path.dirname(filePath), path.resolve(rootDir, target)).split(path.sep).join('/') || '.' : target; });