aurelia / aurelia/webpack-plugin

Alias is not resolved for compose view-model with class reference

Open
#152 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
89
Forks
33
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
3.0.0

**Please tell us about your environment:**
* **Operating System:**
OSX 10.13.5

* **Node Version:**
9.11.1

* **NPM Version:**
6.2.0

* **JSPM OR Webpack AND Version**
Webpack 4.16.2

* **Browser:**
Chrome 68

* **Language:**
ESNext

**Current behavior:**
Alias is not resolved for compose view-model with class reference.

I tried to follow https://github.com/aurelia/webpack-plugin/wiki/Debugging-missing-modules#using-webpack-alias-config but no success.

Steps to replicate:
```
$ au new test
```

Edit files:

`webpack.config.js`

Add
```
alias: {
"@root": srcDir
}
```

`app.js`
```
import {PLATFORM} from "aurelia-framework";
import {Item} from "@root/item";
PLATFORM.moduleName("@root/item");

export class App {
Item = Item;

constructor() {
this.message = 'Hello World!';
}
}
```

`app.html`
```

${message}

```

`item.js`
```
export class Item {}
```

`item.html`
```

Hi

```

Run the app
```
npm start
```

Error is thrown:
```
Unhandled rejection Error: Unable to find module with ID: @root/item.html
```

**Expected/desired behavior:**
* **What is the expected behavior?**
No error, component is displayed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.