babel-loader icon indicating copy to clipboard operation
babel-loader copied to clipboard

Relative paths in source maps

Open byelims opened this issue 11 years ago • 9 comments

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?

byelims avatar Jul 27 '15 07:07 byelims

I second this, it's not nice having full paths..

waeljammal avatar Oct 27 '15 21:10 waeljammal

Agreed, I experience the same issue. The incorrect paths seem to break the WebStorm debugger.

nielssj avatar Nov 04 '15 20:11 nielssj

+1

elektronik2k5 avatar Nov 08 '15 09:11 elektronik2k5

Same here, babel-loader v.6.2.0

winseros avatar Dec 27 '15 19:12 winseros

I came up with a simple fix that should solve the problem - check it out.

mischkl avatar Apr 05 '16 15:04 mischkl

Is this still a problem?

when I try to reproduce the sources look like this: "./fixtures/constant.js"

danez avatar Nov 08 '16 09:11 danez

Invalid absolute resource paths are the reason. [email protected] [email protected] image

dizel3d avatar Dec 01 '16 07:12 dizel3d

Just noticed this may be a duplicate of the issue I just filed #480

chrisnicola avatar Jun 24 '17 00:06 chrisnicola

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

hiradyazdan avatar Jul 03 '18 08:07 hiradyazdan