Zero-Byte Bundle When Making Multiple Bundles with CLI (Bug?)

I’m trying to add a third bundle using the Aurelia CLI bundler on a boilerplate new project. I edit aurelia.json to add a third bundle and run au build. The third bundle appears but is always empty (zero bytes).

Am i missing something or is this a CLI bug?

I note that the vendor-bundle and the first bundle in the list are always compiled correctly, but the subsequent new bundles are always empty, regardless of their sources or names.

Relevant section of aurelia.json:

"bundles": [
  {
    "name": "app-bundle.js",
    "source": [
      "**/*.{js,css,html}"
    ]
  },
  {
    "name": "foo-bundle.js",
    "source": [
      "**/*.{js,css,html}"
    ]
  },
  {
    "name": "vendor-bundle.js",
...

Move foo-bundle to before app-bundle, and describe what you want to put in foo-bundle.

{
    "name": "foo-bundle.js",
    "source": [
      "**/src/folder/*.{js,css,html}",
      "**/src/folder2/*.{js,css,html}"
    ]
  },

Reversing the order does not work. It just builds the first bundle and the second bundle always comes out empty.

It would seem that having overlapping filesets triggers something internal to aurelia that causes it to refuse to build. If i make one bundle from files only from a specific directory it works. If i try to build two identical bundles from the same sources, it fails.

My goal is to build two bundles:

  1. Everything
  2. Everything except [advanced features]

After further experiments, it would seem that files can not be bundled more than once (which entirely defeats the concept of code reuse).

This smells like there is a queue data structure under the hood where files get popped off as they are analyzed and then may never be bundled again.

I hope there is a way to make this work without converting the entire project to webpack. Certainly i’m not the only person who ever needed such a thing. I would like to hear if anyone has done this before.

Thanks for your help.

By design, cli bundler does not dupliate src files among bundles.