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.

Relative paths in source maps

See original GitHub issue

I’m trying to switch from jsx-loader. My webpack.config.js is like this:

module.exports = {
  entry: './src/javascript/main.jsx',
  output: {
    devtoolModuleFilenameTemplate: '[resource-path]',
    path: './public/js/',
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      { test: /\.jsx$/, loaders: ['jsx'] }
    ]
  }
};

This will produce relative paths in source maps.

{
  sources: ["./src/javascript/main.jsx"]
}

If I use babel-loader with the same config, it will produce absolute paths.

{
  sources: ["/full/path/src/javascript/main.jsx"]
}

Are there any methods to solve this problem?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dizel3dcommented, Dec 1, 2016

Invalid absolute resource paths are the reason. babel-core@6.18.2 webpack@2.1.0-beta.27 image

0reactions
hiradyazdancommented, Jul 3, 2018

@byelims you probably need to check whether in your .babelrc your babel presets for production env is different (e.g. if using react it’s not react-hmre) than your development.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generating source maps with relative path in sourceRoot ...
Generating source maps with relative path in sourceRoot option produces maps with abosolute file paths #23180.
Read more >
Webpack: How to get relative path in css sourcemap
The question is, is it possible to shorten the source map to be relative to my project root path? So instead of /Users/xunyang/workspace/ ......
Read more >
APM Sourcemap relative path? - APM - Discuss the Elastic Stack
Our application uses dynamic subdomains - is there a way to upload source maps using a relative path? Right now, if we upload...
Read more >
tweak-sourcemap-paths - npm
Many sourcemap tools will embed relative paths to source files (like ../../foo/bar.js ), or include unnecessary paths (like src/core ).
Read more >
FAQ: Should relative paths to data be stored in map documents?
A relative path is the location of a computer file, given in relation to the current working directory. When a map document stores...
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