aurelia / aurelia/framework

Loading a 'feature' from within a feature requires an absolute path

Open
#376 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
11.7k
Forks
608
PR merge metrics
No merged PRs in 30d

Description

Say I have an app that contain a `feature` that itself is structured as a set of `features`.
Here, `infrastructure` is a feature, and so is `localization` and `logging`:

```
app
├── infrastructure
│ ├── localization
│ │ ├── service1.ts
│ │ └── index.ts
│ ├── logging
│ │ ├── service1.ts
│ │ └── index.ts
│ └── index.ts
└── app.ts
```

Now, in `app.ts` I load the `infrastructure` feature like this:

``` typescript
aurelia.use.feature("./infrastructure/localization")
```

And in `infrastructure/index.ts` I load the nested features like this:

``` typescript
import {FrameworkConfiguration} from "aurelia-framework";

export function configure(use: FrameworkConfiguration)
{
use
.feature("./infrastructure/localization")
.feature("./infrastructure/logging")
}
```

This works, but **I expected that the paths to the nested features would be relative to the current feature** - i.e. just "./localization" and "./logging". That way it would be more resilient to refactoring, and consistent with the way `use.globalResources` works - if I use that inside the `configure` function of a feature, then it expects paths that _are_ relative to that feature.

Contributor guide

Open the contributing guide

Research direction

Start with the feature loading call in app.ts and the configure function in infrastructure/index.ts, comparing nested use.feature paths with the documented use.globalResources behavior. Verify how relative paths are resolved inside a feature and define done as allowing ./localization and ./logging to load from infrastructure/index.ts without absolute or app-root-relative paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.