cli: Loader with custom plugin results in "plugin.load is not a function"

I’m submitting a bug report

  • Library Version: 0.28.0

Please tell us about your environment:

  • Operating System: Ubuntu 16.04

  • Node Version: 6.3.1

  • NPM Version: 4.2.0

  • Browser: all

  • Language: ESNext

Current behavior: Adding a custom plugin to the aurelia-loader-default causes requirejs to throw the exception “TypeError: plugin.load is not a function”

Expected/desired behavior: When adding a custom plugin to the default loader and requiring a resource with this plugin from the html file, the fetch function of the loader implementation is called.

Steps to reproduce

  1. Create a new project using au new loader-plugin-test Name: loader-plugin-test Platform: Web Transpiler: Babel Markup Processor: None CSS Processor: Sass Unit Test Runner: Karma Editor: WebStorm
  2. Create a new javascript file src/loader-plugin/index.js
export function configure(config) {
    const loader = config.aurelia.loader;
    loader.addPlugin('sample', {
        fetch(address) {
            console.log('should be called');
            return loader.loadModule(address);
        }
    })
}
  1. Load the feature in the main.js
  aurelia.use
    .standardConfiguration()
    .feature('loader-plugin')
    .feature('resources');
  1. Run the application au run
  2. Open the application in the browser. There should be an exception in require now.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

No worries I have some day’s time 👍 Thx for your time 😃

PS: If I can support you somehow tell me how 😃