Skip to content

Commit f3e1157

Browse files
authored
fix(alias): paths for aliases across multiple Windows drives (#896)
Removing the drive letter while normalizing the ID was actually breaking the absolute import across multiple Windows drives.
1 parent 89dfa88 commit f3e1157

File tree

3 files changed

+6
-27
lines changed

3 files changed

+6
-27
lines changed

packages/alias/src/index.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import { platform } from 'os';
2-
31
import { PartialResolvedId, Plugin } from 'rollup';
4-
import slash from 'slash';
52

63
import { Alias, ResolverFunction, RollupAliasOptions } from '../types';
74

8-
const VOLUME = /^([A-Z]:)/i;
9-
const IS_WINDOWS = platform() === 'win32';
10-
115
const noop = () => null;
126

137
function matches(pattern: string | RegExp, importee: string) {
@@ -28,9 +22,6 @@ function matches(pattern: string | RegExp, importee: string) {
2822
function normalizeId(id: string): string;
2923
function normalizeId(id: string | undefined): string | undefined;
3024
function normalizeId(id: string | undefined) {
31-
if (typeof id === 'string' && (IS_WINDOWS || VOLUME.test(id))) {
32-
return slash(id.replace(VOLUME, ''));
33-
}
3425
return id;
3526
}
3627

packages/alias/test/test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import path, { posix } from 'path';
22

33
import test from 'ava';
44
import { rollup } from 'rollup';
5-
import slash from 'slash';
65

76
// eslint-disable-next-line import/no-unresolved, import/extensions
87
import nodeResolvePlugin from '@rollup/plugin-node-resolve';
98

109
import alias from '../dist';
1110

12-
const normalizePath = (pathToNormalize) => slash(pathToNormalize.replace(/^([A-Z]:)/, ''));
11+
const normalizePath = (pathToNormalize) => pathToNormalize;
1312
const DIRNAME = normalizePath(__dirname);
1413

1514
/**

pnpm-lock.yaml

Lines changed: 5 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)