Skip to content

Commit

Permalink
Fixed faulty logic related to handling externals when resolver return…
Browse files Browse the repository at this point in the history
…s false (#2351)

* Fixed faulty logic related to handling externals when resolver returns false.

* include a test case
  • Loading branch information
swernerx authored and lukastaegert committed Aug 5, 2018
1 parent 4a5c776 commit cddc570
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Graph.ts
Expand Up @@ -801,7 +801,9 @@ Try defining "${chunkName}" first in the manualChunks definitions of the Rollup
const externalId =
<string>resolvedId ||
(isRelative(source) ? resolve(module.id, '..', source) : source);
let isExternal = this.isExternal.call(this.pluginContext, externalId, module.id, true);
let isExternal =
resolvedId === false ||
this.isExternal.call(this.pluginContext, externalId, module.id, true);

if (!resolvedId && !isExternal) {
if (isRelative(source)) {
Expand Down
23 changes: 23 additions & 0 deletions test/function/samples/external-resolve-false/_config.js
@@ -0,0 +1,23 @@
var assert = require('assert');
var path = require('path');

module.exports = {
description: 'includes an external module with a false resolve return',
options: {
input: 'main.js',
plugins: [
{
resolveId: function(id) {
if (id === './external')
return false;
}
}
]
},
context: {
require: function(required) {
assert.equal(required, './external');
return 1;
}
}
};
1 change: 1 addition & 0 deletions test/function/samples/external-resolve-false/main.js
@@ -0,0 +1 @@
import './external';

0 comments on commit cddc570

Please sign in to comment.