Skip to content

Commit

Permalink
CB-12284 Include project root as additional root for static router
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
TimBarham committed Dec 21, 2016
1 parent acf7b48 commit 84fa8e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -6,7 +6,7 @@ temp
.DS_Store
spec-cordova/fixtures/projects/native
spec-cordova/fixtures/projects/cordova
.idea/*
.idea
.gitcore
*.jar
.vscode
Expand Down
7 changes: 7 additions & 0 deletions cordova-serve/src/server.js
Expand Up @@ -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;
Expand Down

0 comments on commit 84fa8e3

Please sign in to comment.