Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using aliases/paths not supported in require tag #43

Open
michaelw85 opened this issue Feb 26, 2019 · 0 comments
Open

Using aliases/paths not supported in require tag #43

michaelw85 opened this issue Feb 26, 2019 · 0 comments

Comments

@michaelw85
Copy link

michaelw85 commented Feb 26, 2019

I'm submitting a bug report

  • Library Version:
    aurelia-loader-webpack 2.2.1

Please tell us about your environment:

  • Operating System:
    Windows [10]

  • Node Version:
    10.15.1

  • NPM Version:
    6.4.1

  • JSPM OR Webpack AND Version
    webpack 4.29.0

  • Browser:
    Chrome Version 72.0.3626.119 (Official Build) (64-bit)

  • Language:
    TypeScript 3.3.1

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.

  • What is the motivation / use case for changing the behavior?
    Enable usage of aliases making paths in the require statement easier to maintain.

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 {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant