webpack-contrib / transform-loader

transform loader for webpack
MIT License
110 stars 23 forks source link

issue with webpack + ES6/babel and sourceMaps #9

Closed revolunet closed 6 years ago

revolunet commented 9 years ago

Hey!

When using transform-loader with babel looks like it breaks the source maps.

Here's my config :

loaders: [{
    test: /\.(js|es6|jsx)$/,
    exclude: /node_modules/,
    loaders: [
        'transform/cacheable?brfs',
        'babel'
    ]
}]

when transform enabled, chrome directs me to the ES5 transpiled code. if i comment the line, i have the correct sources in chrome.

any idea how to fix this ?

Thanks!

revolunet commented 9 years ago

(tried with devtool: 'eval-source-map', and every other option without luck)

sokra commented 9 years ago

This doesn't work for two reasons:

revolunet commented 9 years ago

Thanks for the feedback ! so is there any way to fix this ?

when using browserify/brfs i think i had the sourcemaps working;

sokra commented 9 years ago

when using browserify/brfs i think i had the sourcemaps working;

I tried it again, but brfs doesn't emit a SourceMap. coffeeify does.

revolunet commented 9 years ago

ok thanks man!

thaiat commented 9 years ago

for a quick and dirty workaround: https://github.com/thaiat/webpack-babel-sourcemap

steveinatorx commented 7 years ago

@thaiat solution worked for me ! move babel to the first loader and add a query block with retainLines: true

module: {
    loaders: [{
      test: /\.js$/,
      loader: "babel",
      exclude: /node_modules/,
      include: __dirname,
      query: {
        retainLines: true,
        cacheDirectory: true
      }
    }]