Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit a83380a

Browse files
authored
fix-next(HMR): resolve correctly modulePath in hot loaders (#781)
Use `this.rootContext` instead of `this.context`. For example in this [second-page](https://github.com/NativeScript/nativescript-dev-webpack/blob/master/demo/TypeScriptApp/app/views/second-page.xml) module: ---> `this.resourcePath` is /Users/vchimev/git/nativescript-dev-webpack/demo/TypeScriptApp/app/views/second-page.xml ---> `this.context` is /Users/vchimev/git/nativescript-dev-webpack/demo/TypeScriptApp/app/views ---> `this.rootContext` is /Users/vchimev/git/nativescript-dev-webpack/demo/TypeScriptApp/app ---> `modulePath` should be ./views/second-page.xml
1 parent 0d9ecec commit a83380a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

‎markup-hot-loader.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ const { reload } = require("./hot-loader-helper");
22

33
module.exports = function (source) {
44
const typeMarkup = "markup";
5-
const modulePath = this.resourcePath.replace(this.context, ".");
5+
const modulePath = this.resourcePath.replace(this.rootContext, ".");
66
return `${source};${reload({ type: typeMarkup, module: modulePath })}`;
77
};

‎script-hot-loader.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ const { reload } = require("./hot-loader-helper");
22

33
module.exports = function (source) {
44
const typeScript = "script";
5-
const modulePath = this.resourcePath.replace(this.context, ".");
5+
const modulePath = this.resourcePath.replace(this.rootContext, ".");
66
return `${source};${reload({ type: typeScript, module: modulePath })}`;
77
};

‎style-hot-loader.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ const { reload } = require("./hot-loader-helper");
22

33
module.exports = function (source) {
44
const typeStyle = "style";
5-
const modulePath = this.resourcePath.replace(this.context, ".");
5+
const modulePath = this.resourcePath.replace(this.rootContext, ".");
66
return `${source};${reload({ type: typeStyle, module: modulePath })}`;
77
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /