Skip to content

Commit ae59ceb

Browse files
committedMay 1, 2022
fix(node-resolve): Revert respect if other plugins resolve the resolution to a different id
This reverts commit f8d4c44.
1 parent f8d4c44 commit ae59ceb

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed
 

‎packages/node-resolve/src/index.js

-5
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ export function nodeResolve(opts = {}) {
281281
if (resolvedResolved.external) {
282282
return false;
283283
}
284-
// Allow other plugins to take over resolution. Rollup core will not
285-
// change the id if it corresponds to an existing file
286-
if (resolvedResolved.id !== resolved.id) {
287-
return resolvedResolved;
288-
}
289284
// Pass on meta information added by other plugins
290285
return { ...resolved, meta: resolvedResolved.meta };
291286
}

‎packages/node-resolve/test/test.js

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join, resolve, dirname } from 'path';
1+
import { join, resolve } from 'path';
22

33
import test from 'ava';
44
import { rollup } from 'rollup';
@@ -581,31 +581,3 @@ test('passes on meta information from other plugins', async (t) => {
581581
]
582582
});
583583
});
584-
585-
test('allow other plugins to take over resolution', async (t) => {
586-
await rollup({
587-
input: 'entry/main.js',
588-
onwarn: failOnWarn(t),
589-
plugins: [
590-
nodeResolve(),
591-
{
592-
name: 'change-resolution',
593-
resolveId(importee) {
594-
if (importee.endsWith('main.js')) {
595-
return {
596-
id: join(dirname(importee), 'other.js'),
597-
meta: { 'change-resolution': 'changed' }
598-
};
599-
}
600-
return null;
601-
},
602-
603-
load(id) {
604-
const info = this.getModuleInfo(id);
605-
t.is(info.id, join(__dirname, 'fixtures', 'entry', 'other.js'));
606-
t.deepEqual(info.meta, { 'change-resolution': 'changed' });
607-
}
608-
}
609-
]
610-
});
611-
});

0 commit comments

Comments
 (0)
Please sign in to comment.