aurelia / loader-webpack

An implementation of Aurelia's loader interface to enable webpack.
MIT License
26 stars 10 forks source link

Using aliases/paths not supported in require tag #43

Open michaelw85 opened 5 years ago

michaelw85 commented 5 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: Require custom component does not work from template when using an alias/ts path.

<require from="@root/hello-world/hello-world"></require>
Error: Unable to find module with ID: @root/hello-world/hello-world.html
    at WebpackLoader.eval (aurelia-loader-webpack.js?e63c:197)
    at step (aurelia-loader-webpack.js?e63c:41)
    at Object.eval [as next] (aurelia-loader-webpack.js?e63c:22)
    at eval (aurelia-loader-webpack.js?e63c:16)
    at new Promise (<anonymous>)
    at __awaiter (aurelia-loader-webpack.js?e63c:12)
    at WebpackLoader._import (aurelia-loader-webpack.js?e63c:162)
    at WebpackLoader.eval (aurelia-loader-webpack.js?e63c:262)
    at step (aurelia-loader-webpack.js?e63c:41)
    at Object.eval [as next] (aurelia-loader-webpack.js?e63c:22)

Expected/desired behavior: When aliases are configured in webpack I expect the loader to include these trying to resolve the module.

Workaround Load in TS and pass the class using viewResources decorator.

import { HelloWorldCustomElement } from '@root/hello-world/hello-world';
import { viewResources } from 'aurelia-templating';

@viewResources(HelloWorldCustomElement)
export class App {}