Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit ae1cceb

Browse files
committed
fix: resolve appComponents absolute paths on Windows
Fix #573.
1 parent 6b0f56b commit ae1cceb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Diff for: android-app-components-loader.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
module.exports = function(source) {
1+
const { convertSlashesInPath } = require("./projectHelpers");
2+
3+
module.exports = function (source) {
24
this.cacheable();
35
const { modules } = this.query;
4-
const imports = modules.map(m => `require("${m}");`).join("\n");
6+
const imports = modules.map(m => convertSlashesInPath(m))
7+
.map(m => `require("${m}");`).join("\n");
58
const augmentedSource = `
69
if (!global["__snapshot"]) {
710
${imports}

Diff for: projectHelpers.js

+11
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ function safeGet(object, property, ...args) {
6666
value;
6767
}
6868

69+
// Convert paths from C:\some\path to C:/some/path in order to be required
70+
function convertSlashesInPath(modulePath) {
71+
if (isWindows) {
72+
modulePath = modulePath.replace(/\\/g, "/");
73+
}
74+
return modulePath;
75+
}
76+
77+
const isWindows = process.platform.startsWith("win32");
78+
6979
module.exports = {
7080
getAppPathFromProjectData,
7181
getAppResourcesPathFromProjectData,
@@ -76,4 +86,5 @@ module.exports = {
7686
isAngular,
7787
isTypeScript,
7888
writePackageJson,
89+
convertSlashesInPath
7990
};

0 commit comments

Comments
 (0)