jensarps / AMD-feature

A loader plugin for AMD loaders
Other
161 stars 10 forks source link

Build related error #1

Closed untoldone closed 11 years ago

untoldone commented 11 years ago

I haven't dug into the issue yet as I don't know much about requirejs's plugin arch yet -- but I got the following error when trying to use this with r.js to build:

Loader plugin did not call the load callback in the build: feature

This is when using a map that looks like this:

define({
  'core/web': [
    {
      isAvailable: function () {
        return LiftWithoutServer;
      },

      implementation: 'core/dev-web'
    },
    {
      isAvailable: function () {
        return true;
      },

      implementaiton: 'core/web'
    }
  ]
});

a require line that looks like:

var Web = require('feature!core/web'); // using commonjs style

and an app config that looks like (simplified for the purpose of removing seemingly irrelevant parts of config):

requirejs.config({
  baseUrl: 'scripts',
  paths: {
    'feature'               : 'vendor/feature-nover',  // i renamed 'feature.js' to 'feature-nover.js'
    'implementations'       : 'core/feature-map',
  }
});

I imagine this is just something I'm doing wrong but a pointer in the readme (maybe an FAQ or pitfalls section or something?) would have allowed me to skip over learning more about requirejs plugins to figure out whats going on.

Thanks!

jensarps commented 11 years ago

Thanks for reporting!

The code you posted looks perfectly fine, I don't think it's something on your side, it rather looks like the plugin stopped working correctly with r.js. I won't be available next week, but I'll look into this as soon as I can when I'm back.

What version of r.js are you using?

untoldone commented 11 years ago

r.js version 2.0.6. It's actually possible I'm miss understanding how the plugin is intended to work?

I fixed the issue by removing the if(config.isbuild ...) block. Now when I run r.js it picks the file version that load is called on to include in the build.

jensarps commented 11 years ago

If the feature map used during build contains feature tests, the plugin should keep them and evaluate them during run-time, and not during build-time, so that builds can be used for different scenarios. But maybe this should be configurable...

The last version of r.js I checked against was 0.24 I guess, so it might well be that something changed there - sorry for the inconvenience.

jensarps commented 11 years ago

Builds work fine for me now with latest r.js – can you please check to make sure it works for you, too?