question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Custom Loader Config Generators

See original GitHub issue

I’m submitting a feature request It would be nice to have the ability to create our own loader config generator so that custom configs for the application (whether it’s RequireJS, SystemJS, or any other module loader) can be created. This would allow a user to generate their own config for their own setup without having to rely on the CLI to provide one itself.

Additionally, having the ability to create you own loader config comes with the benefits of creating custom configs that are needed for testing frameworks like Karma and Wallaby.

What we could do is provide the basic configuration setups (currently just RequireJS, and hopefully soon SystemJS and Webpack), but allow the user to define their own in the aurelia.json file. I’m thinking that we could make use of the build.loader.type option to do this. The CLI could look at the type and if it matches one of the prebuilt ones (require, system, webpack) then it would simply use the one it had. But if it didn’t match a prebuilt generator, then we could read it as a path to load the custom generator.

For example. A default configuration looks like this for the loader:

"loader": {
      "type": "require",
      "configTarget": "vendor-bundle.js",
      "includeBundleMetadataInConfig": "auto",
      "plugins": [
        {
          "name": "text",
          "extensions": [
            ".html",
            ".css"
          ],
          "stub": true
        }
      ]
    },

Using that setup, we would simply use the prebuilt requirejs config generator. But the user could also do something like this:

"loader": {
      "type": "configGenerators/awesome-loader",
      "configTarget": "vendor-bundle.js",
      "includeBundleMetadataInConfig": "auto",
      "plugins": [
        {
          "name": "text",
          "extensions": [
            ".html",
            ".css"
          ],
          "stub": true
        }
      ]
    },

This setup would not match any prebuilt generator, and instead would now look to the file path listed to load up the generator and create the module loader configuration.

Thoughts, ideas?
The immediate use we would have for this would be to create custom configurations for Karma and Wallaby test runners.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AStokercommented, May 31, 2022

I’m not sure this is even a highly needed feature anymore. At the time of the original feature request, our department was in the midst of a transition of builders, and we had some weird quirks we were trying to work around. I think at this point there’s enough functionality that solves the original problem we had. Since there hasn’t been any activity on this, I think it’s worth closing down. If somebody ends up wanting this, we can resurrect this thread, or more likely open a new one and reference this one.

0reactions
3cpcommented, May 25, 2022

I think it’s already implemented.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module | webpack - JS.ORG
It's possible to configure all generators' options in one place with a ... Generator options for asset/resource modules // Customize publicPath for ...
Read more >
Customizing Webpack Config - Nx
The custom webpack file contains a function that takes as input the existing webpack config and then returns a modified config object. context...
Read more >
Unable to create custom document loader for glob pattern ...
I am now running into the issue that the custom document loader functionality provided by GraphQL Codegen (and if I followed the code...
Read more >
Custom Webpack Config in an Nx Workspace - the Video
This is my talk from nx conf 2021 on how to customize webpack config in an Nx workspace.
Read more >
Creating custom data generator for training Deep Learning ...
Chapter-2: Writing a generator function to read your data that can be fed for training an image classifier in Keras.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found