[ 
https://issues.apache.org/jira/browse/CB-12284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15765931#comment-15765931
 ] 

ASF GitHub Bot commented on CB-12284:
-------------------------------------

GitHub user TimBarham opened a pull request:

    https://github.com/apache/cordova-lib/pull/512

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

    ### Platforms affected
    All
    
    ### What does this PR do?
    With this change, cordova-serve includes the project root as an additional 
root for static routing. This is the final piece a middleware, so will only be 
utilized when a file isn't found through other means (the default static 
routing which points to the platform root, or other middleware that may have 
been injected by a third party).
    
    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).
    
    ### What testing has been done on this change?
    Verified is resolved the problem reported in the bug, and lets you debug 
using original TypeScript sources in a TypeScript project, as long as the path 
to the TypeScript source relative to the project root mirrors the path to the 
generated JavaScript and map file relative to the www folder.
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/TimBarham/cordova-lib CB-12284

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/512.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #512
    
----
commit 84fa8e39b22252381ed4baa6868ff6f22b7a48e2
Author: TimBarham <[email protected]>
Date:   2016-12-21T02:18:44Z

    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).

----


> Source map source file not found in Chrome
> ------------------------------------------
>
>                 Key: CB-12284
>                 URL: https://issues.apache.org/jira/browse/CB-12284
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CordovaServe
>    Affects Versions: Master
>            Reporter: Tim Barham
>            Assignee: Tim Barham
>             Fix For: Master
>
>
> If you have a Cordova project that does some sort of transpiling (for 
> example, TypeScript -> JavaScript) and the source files aren't under the www 
> folder, the original source files can't be found when debugging in a browser.
> For example, you might have a project with these files:
> scripts/foo.ts
> www/scripts/foo.js
> www/scripts/foo.js.map
> The map file will likely link back to the original ts file as 
> {{../../scripts/foo.ts}}
> Launch the project in a browser ({{cordova run browser}}), the path to the 
> original ts file is invalid (in the context of the server) and the file isn't 
> found.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to