Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locate-only plugins are broken/ignored in 0.20.5 (workaround provided) #1568

Closed
Rush opened this issue Feb 7, 2017 · 7 comments
Closed

Locate-only plugins are broken/ignored in 0.20.5 (workaround provided) #1568

Rush opened this issue Feb 7, 2017 · 7 comments

Comments

@Rush
Copy link

Rush commented Feb 7, 2017

Sample plugin:

// user for browserConfig only
// import pug files with "sample.pug!" when server is doing the compilation for ".pug.js" requests
exports.locate = function(load) {
  return Promise.resolve(load.address + '.js');
};

The result is being assigned here

metadata.pluginLoad.address = address;

But since the plugin does not have the fetch method it is then being ignored:

if (!metadata.pluginModule.fetch)

the provided load.address is only used when also .fetch is provided

return fetch(load.address, metadata.load.authorization, metadata.load.integrity, false);

@Rush
Copy link
Author

Rush commented Feb 7, 2017

A working workaround:

exports.fetch = function(load, origFetch) {
  return origFetch(load);
}

exports.locate = function(load) {
  return Promise.resolve(load.address + '.js');
};

@Rush Rush changed the title Locate-only plugins are broken/ignored in 0.20 Locate-only plugins are broken/ignored in 0.20.5 Feb 7, 2017
@Rush
Copy link
Author

Rush commented Feb 7, 2017

Another issue, previously (in pre-0.20) it was possible to define a plugin without a promise:

exports.locate = function(load) {
  return load.address + '.js';
};

Would be nice to have it for compatibility.

@Rush Rush changed the title Locate-only plugins are broken/ignored in 0.20.5 Locate-only plugins are broken/ignored in 0.20.5 + workaround Feb 7, 2017
@Rush Rush changed the title Locate-only plugins are broken/ignored in 0.20.5 + workaround Locate-only plugins are broken/ignored in 0.20.5 (workaround provided) Feb 7, 2017
@guybedford
Copy link
Member

Thanks this would be a bug, will aim to fix this.

@guybedford
Copy link
Member

Fixed in 7d47f1b.

@Rush
Copy link
Author

Rush commented Feb 9, 2017

@guybedford thanks. What about the first part of the issue where a plugin with .locate only is ignored?

@guybedford
Copy link
Member

@Rush sure I've added a842efb.

@guybedford
Copy link
Member

Released in 0.20.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants