Skip to content

Commit

Permalink
fix packager patch to auto-generate index.*.map files
Browse files Browse the repository at this point in the history
- looks like in case of error RN tries to load index.ios.map, this file is normally generated by packager. Need to keep it this way.
  • Loading branch information
drapanjanas committed Jan 21, 2016
1 parent f15d988 commit a59efba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ Re-Natal makes almost no changes to the files generated by react-native so the o
### Changes Re-Natal does to original RN application
It would be perfect not to do any changes there, but...
* To make source maps available in "Debug in Chrome" mode re-natal patches
the react native packager to serve \*.map files from file system.
To do this [these lines are commented](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/Server/index.js#L400-L401)
in file "node_modules/react-native/packager/react-packager/src/Server/index.js"
the react native packager to serve \*.map files from file system and generate only index.\*.map file.
To achieve this [this line](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/Server/index.js#L400)
of file "node_modules/react-native/packager/react-packager/src/Server/index.js" is modified to match only index.\*.map

## Tips
- Having `rlwrap` installed is optional but highly recommended since it makes
Expand Down
5 changes: 2 additions & 3 deletions re-natal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@ updateGitIgnore = () ->

patchReactNativePackager = () ->
log "Patching react-native packager to serve *.map files"
edit "node_modules/react-native/packager/react-packager/src/Server/index.js", [
[/^(\s*requestType\s*=\s*'map'\s*;)$/m, "//$1"],
[/^(\s*}\s*else\s*if.*pathname\.match.*\.map.*\{)$/m, "//$1"]]
edit "node_modules/react-native/packager/react-packager/src/Server/index.js",
[[/match.*\.map\$\/\)/m, "match(/index\\..*\\.map$/)"]]

init = (projName) ->
if projName.toLowerCase() is 'react' or !projName.match validNameRx
Expand Down

0 comments on commit a59efba

Please sign in to comment.