aurelia / aurelia/loader-webpack

View only routes importing incorrectly

Open
#42 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
24
Forks
9
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
2.2.1

**Please tell us about your environment:**
* **Operating System:**
Windows 8.1

* **Node Version:**
10.8.0

* **NPM Version:**
6.2.0

* **JSPM OR Webpack AND Version**
webpack 4.16.5

* **Browser:**
all
* **Language:**
TypeScript 3.01

**Current behavior:**

When directing to html templates as module id in routes:
`
routes = [{
moduleId: PLATFORM.moduleName('foo.html'),
}]
`

`this._import(moduleId, defaultHMR)` in method `loadModule` in `WebpackLoader` returns rejected promise with value `Error: Unable to find module with ID: ./foo.html at WebpackLoader`

**Expected/desired behavior:**

* **What is the expected behavior?**

Everything works correctly if `.html` suffix is omited and new file foo.ts with empty class inside it is created.

According to feature https://github.com/aurelia/templating-router/pull/25 using only html views should work. Implementation of this feature was done by dynamically creation empty of class and it seems that loader is not aware of it happening.

Contributor guide

Open the contributing guide

Research direction

Start at the WebpackLoader.loadModule method and its this._import(moduleId, defaultHMR) call. Reproduce the route using PLATFORM.moduleName('foo.html') with webpack 4.16.5, then trace how the dynamically created empty class is handled. Done means an HTML-only route imports successfully without creating a foo.ts file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.