question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babelify 7.2.0 change the way source map path is generated

See original GitHub issue

When I use babelify 6.4.0, I have this inside my source map file:

"sources": [
    "node_modules/browser-pack/_prelude.js",
    "C:/Users/Osman/Dropbox/react-flux-init/client.js",
    "C:/Users/Osman/Dropbox/react-flux-init/components/About.jsx",
    "C:/Users/Osman/Dropbox/react-flux-init/components/App.jsx",
    "C:/Users/Osman/Dropbox/react-flux-init/components/Index.jsx",
    "node_modules/deep-equal/index.js",
    "node_modules/deep-equal/lib/is_arguments.js",
    "node_modules/deep-equal/lib/keys.js",
    "node_modules/history/lib/Actions.js",
    "node_modules/history/lib/AsyncUtils.js",
    "node_modules/history/lib/DOMStateStorage.js",
    "node_modules/history/lib/DOMUtils.js",
    "node_modules/history/lib/ExecutionEnvironment.js",
    "node_modules/history/lib/createBrowserHistory.js",
    "node_modules/history/lib/createDOMHistory.js",
    "node_modules/history/lib/createHistory.js",
    "node_modules/history/lib/createLocation.js",
    "node_modules/history/lib/deprecate.js",
    "node_modules/history/lib/extractPath.js",
    "node_modules/history/lib/parsePath.js",
    "node_modules/history/lib/runTransitionHook.js",
    "node_modules/invariant/browser.js",
    "node_modules/process/browser.js",
    "node_modules/warning/browser.js",
    "C:/Users/Osman/Dropbox/react-flux-init/routes.js"
  ],

And when I use babelify 7.2.0, I have this:

"sources": [
    "node_modules/browser-pack/_prelude.js",
    "client.js",
    "components\\About.jsx",
    "components\\App.jsx",
    "components\\Index.jsx",
    "node_modules/deep-equal/index.js",
    "node_modules/deep-equal/lib/is_arguments.js",
    "node_modules/deep-equal/lib/keys.js",
    "node_modules/history/lib/Actions.js",
    "node_modules/history/lib/AsyncUtils.js",
    "node_modules/history/lib/DOMStateStorage.js",
    "node_modules/history/lib/DOMUtils.js",
    "node_modules/history/lib/ExecutionEnvironment.js",
    "node_modules/history/lib/createBrowserHistory.js",
    "node_modules/history/lib/createDOMHistory.js",
    "node_modules/history/lib/createHistory.js",
    "node_modules/history/lib/createLocation.js",
    "node_modules/history/lib/deprecate.js",
    "node_modules/history/lib/extractPath.js",
    "node_modules/history/lib/parsePath.js",
    "node_modules/history/lib/runTransitionHook.js",
    "node_modules/invariant/browser.js",
    "node_modules/process/browser.js",
    "node_modules/warning/browser.js",
    "routes.js"
  ],

Using babelify 6.4.0 the result in chrome dev tools is:

image

Using babelify 7.2.0 the result in chrome dev tools is:

image

The problem is that I have components\About.jsx like the name of the file instead of the file About.jsx inside a folder structure.

In the source map files, we can see that in babelify 6.4.0 we have C:/Users/Osman/Dropbox/react-flux-init/components/About.jsx and in babelify 7.2.0 we have components\\About.jsx. I bet the problem is the use of \\ instead of / to make folder path. Other thing to notice is that the first is full path, and the second is relative to project folder.

Why babelify change this behavior? Is it a bug? What should I do to have the first behavior in babelify 7.2.0? It wasn’t easy to find this. I searched a lot.

Ps1.: I used exorcist package to take the source map in external file.

Ps2.: I think this is a very specific question, so I prefered post here instead of stackoverflow.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
zertoshcommented, Apr 26, 2016

I’ve published babelify@7.3.0. There’s no sourceMapRelative option anymore. Instead, there’s a sourceMapsAbsolute that you can set to get the old behavior.

1reaction
kuragacommented, Apr 26, 2016

Thanks very much! Confirm: it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get sourcemaps for gulp+babel+browserify+uglify
First of all you need to set browserify to generate source maps by setting the debug option to true, then if you want...
Read more >
Dependencies | roo | npm
concat-map. 0.0.1. Indirect. MIT. 0. Version, 0.0.1, Published, January 30, 2014, Description, concatenative mapdashery. arrow_right
Read more >
babelify
Start using babelify in your project by running `npm i babelify`. ... By default, browserify sets the source map sources paths relative to ......
Read more >
Node.js - Junkman
Create a character voting app using React, Node.js, MongoDB and Socket.IO. In this tutorial we are going to build a character voting app...
Read more >
Notices_BigFix_Lifecycle_Starter...
BSD 3 source-map-0.6.1.tgz Generates and consumes source maps ... different formats and allows adding/changing properties. ... MIT commander-7.2.0.tgz.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found