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

Commit 13081a5

Browse files
committed
fix: resolve appComponents absolute paths on Windows
Fix #573.
1 parent ba68a1b commit 13081a5

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
@@ -90,6 +90,16 @@ function safeGet(object, property, ...args) {
9090
value;
9191
}
9292

93+
// Convert paths from C:\some\path to C:/some/path in order to be required
94+
function convertSlashesInPath(modulePath) {
95+
if (isWindows) {
96+
modulePath = modulePath.replace(/\\/g, "/");
97+
}
98+
return modulePath;
99+
}
100+
101+
const isWindows = process.platform.startsWith("win32");
102+
93103
module.exports = {
94104
getAppPathFromProjectData,
95105
getAppResourcesPathFromProjectData,
@@ -101,4 +111,5 @@ module.exports = {
101111
isAngular,
102112
isTypeScript,
103113
writePackageJson,
114+
convertSlashesInPath
104115
};

0 commit comments

Comments
 (0)