Closed jussimattila closed 6 years ago
If you will consider providing a PR to this repo.. There are some guidelines on commit messages. Which help to build change log.
Sure, I didn't have time for it immediately, but if that is desired, I'll have a look at contribution guidelines and prepare a PR during this week.
PR waiting. @niieani & @EisenbergEffect who can review it?
Not sure what was the reason I didn't handle async modules, but if it fixes the problem, then that's great, since it shouldn't cause any issues. Thanks!
I'm submitting a bug report
Please tell us about your environment:
Operating System: Windows 10
Node Version: 9.7.1
NPM Version: 5.6.0
JSPM OR Webpack AND Version webpack 2.3.3
Browser: all (tested on Chrome 64 | Firefox 58)
Language: TypeScript 2.2.2
Current behavior: Hot module replacement of TypeScript source code doesn't work with Aurelia modules that have been split to a separate file using
PLATFORM.modulesName(...)
overload with chunk parameter, e.g.PLATFORM.moduleName(/* module */ '../counter/counter', /* chunk */ 'counter')
. Removing the second argument ('counter'
) allows HMR to work normally.To reproduce:
Create a new aurelia application using Microsoft's SpaTemplates:
dotnet new aurelia
. You may need to install the templates first usingdotnet new -i "Microsoft.AspNetCore.SpaTemplates::*"
. After the project is created,npm install
dependencies.Make one change in
app.ts
, modify line 20 to:moduleId: PLATFORM.moduleName('../counter/counter', 'counter'),
, i.e. add the chunk name argument. Run the application with HMR. Load counter page and click on the increment button to see it add 1 to counter. Now change code incounter.ts
fromthis.currentCount += 1;
tothis.currentCount += 10;
and save changes. HMR kicks in and does something, but falls short on actually updating the application. Click on the increment button and see that it is still adding only 1, not 10.Changes in TypeScript source code should be reflected in the running application through HMR. Change to the increment code should affect the result from clicking on the increment button.
I wan't to develop modules using code splitting and with HMR enabled.
module.hot.accept(asyncModuleId, () => {});
to:module.hot.accept(asyncModuleId, () => this.hmrContext.handleModuleChange(moduleId, module.hot));
I've not contributed to Aurelia, but here's a PR on my fork for the change that appears to fix this issue: https://github.com/jussimattila/loader-webpack/pull/1