Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(node-resolve): Revert respect if other plugins resolve the resolu…
…tion to a different id

This reverts commit f8d4c44.
  • Loading branch information
lukastaegert committed May 1, 2022
1 parent f8d4c44 commit ae59ceb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
5 changes: 0 additions & 5 deletions packages/node-resolve/src/index.js
Expand Up @@ -281,11 +281,6 @@ export function nodeResolve(opts = {}) {
if (resolvedResolved.external) {
return false;
}
// Allow other plugins to take over resolution. Rollup core will not
// change the id if it corresponds to an existing file
if (resolvedResolved.id !== resolved.id) {
return resolvedResolved;
}
// Pass on meta information added by other plugins
return { ...resolved, meta: resolvedResolved.meta };
}
Expand Down
30 changes: 1 addition & 29 deletions packages/node-resolve/test/test.js
@@ -1,4 +1,4 @@
import { join, resolve, dirname } from 'path';
import { join, resolve } from 'path';

import test from 'ava';
import { rollup } from 'rollup';
Expand Down Expand Up @@ -581,31 +581,3 @@ test('passes on meta information from other plugins', async (t) => {
]
});
});

test('allow other plugins to take over resolution', async (t) => {
await rollup({
input: 'entry/main.js',
onwarn: failOnWarn(t),
plugins: [
nodeResolve(),
{
name: 'change-resolution',
resolveId(importee) {
if (importee.endsWith('main.js')) {
return {
id: join(dirname(importee), 'other.js'),
meta: { 'change-resolution': 'changed' }
};
}
return null;
},

load(id) {
const info = this.getModuleInfo(id);
t.is(info.id, join(__dirname, 'fixtures', 'entry', 'other.js'));
t.deepEqual(info.meta, { 'change-resolution': 'changed' });
}
}
]
});
});

0 comments on commit ae59ceb

Please sign in to comment.