You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/06/06 05:43:25 UTC

[19/24] cordova-serve git commit: CB-12284 Include project root as additional root for static router

CB-12284 Include project root as additional root for static router

This can be useful in cases where source files that have been transpiled (such as TypeScript files) are located under the project root on a path that mirrors the the transpiled file's path under the platform root, and is pointed to by a map file (otherwise when debugging in a browser, the browser won't be able to find the original source file).


Project: http://git-wip-us.apache.org/repos/asf/cordova-serve/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-serve/commit/02ff12fe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-serve/tree/02ff12fe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-serve/diff/02ff12fe

Branch: refs/heads/master
Commit: 02ff12fe919034a5c70b260d8fa782351b7a4b7b
Parents: 68cce11
Author: TimBarham <ti...@microsoft.com>
Authored: Wed Dec 21 12:18:44 2016 +1000
Committer: TimBarham <ti...@microsoft.com>
Committed: Wed Dec 21 12:18:44 2016 +1000

----------------------------------------------------------------------
 src/server.js | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-serve/blob/02ff12fe/src/server.js
----------------------------------------------------------------------
diff --git a/src/server.js b/src/server.js
index bb10a21..9040d2b 100644
--- a/src/server.js
+++ b/src/server.js
@@ -55,6 +55,13 @@ module.exports = function (opts) {
         app.use(express.static(opts.root));
     }
 
+    // If we have a project root, make that available as a static root also. This can be useful in cases where source
+    // files that have been transpiled (such as TypeScript) are located under the project root on a path that mirrors
+    // the the transpiled file's path under the platform root and is pointed to by a map file.
+    if (this.projectRoot) {
+        app.use(express.static(this.projectRoot));
+    }
+
     var that = this;
     server.listen(port).on('listening', function () {
         that.port = port;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org