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

Commit 2bec324

Browse files
authored
Merge branch 'master' into fix-windows-resolved-alias
2 parents 8a194dc + 4b8a087 commit 2bec324

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.3.1",
44
"description": "Resolves aliases with Rollup",
55
"main": "dist/rollup-plugin-alias.js",
6+
"module": "dist/rollup-plugin-alias.es2015.js",
67
"jsnext:main": "dist/rollup-plugin-alias.es2015.js",
78
"scripts": {
89
"prebuild": "rimraf dist",

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function alias(options = {}) {
5959
// First match is supposed to be the correct one
6060
const toReplace = aliasKeys.find(key => matches(key, importeeId));
6161

62-
if (!toReplace) {
62+
if (!toReplace || !importerId) {
6363
return null;
6464
}
6565

test/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ test('Absolute local aliasing', t => {
8888
t.is(resolved4, '/par/a/di/se.js');
8989
});
9090

91+
test('Leaves entry file untouched if matches alias', t => {
92+
const result = alias({
93+
abacaxi: './abacaxi',
94+
});
95+
96+
const resolved = result.resolveId('abacaxi/entry.js', undefined);
97+
98+
t.is(resolved, null);
99+
});
100+
91101
test('Test for the resolve property', t => {
92102
const result = alias({
93103
ember: './folder/hipster',

0 commit comments

Comments
 (0)