aurelia / webpack-plugin

A plugin for webpack that enables bundling Aurelia applications.
MIT License
90 stars 36 forks source link

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

Open zakjan opened 6 years ago

zakjan commented 6 years ago

I'm submitting a bug report

Please tell us about your environment:

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

<template>
  <h1>${message}</h1>

  <compose view-model.bind="Item"></compose>
</template>

item.js

export class Item {}

item.html

<template>
    Hi
</template>

Run the app

npm start

Error is thrown:

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

Expected/desired behavior:

pat841 commented 6 years ago

Please try #139 and see if that fixes your issue.