A
A
Alexander2017-06-08 12:10:47
webpack
Alexander, 2017-06-08 12:10:47

How to use source-map-loader?

Added source-map-loader to the project, but the chrome console still shows errors in the bundle, and not in a separate script.
webpack.config.js

module.exports = {
    context: __dirname + "/src",
    entry: "./index",
    output: {
        path: __dirname + "/dist",
        filename: "bundle.js"
    },
    watch:true,
    devtool:"source-map",
    module: {
       loaders: [
         {
           test: /.js?$/,
           loader: 'babel-loader',
           exclude: /node_modules/,
           query: {
             presets: ['es2015', 'react']
           }
         },
         {
            test: /\.js$/,
            use: ["source-map-loader"],
            enforce: "pre"
         },
         {
           test: /\.css$/,
           use: [ 'style-loader', 'css-loader' ]
         }
       ]
     }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zakhar Yakovlev, 2018-02-28
@hezymal

Most likely, you do not have the download of the generated source-map in chrome enabled, you can see how to enable it here: https://gist.github.com/jakebellacera/336c4982194b...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question