I
I
Ilya Kochkin2021-09-03 16:54:57
gulp.js
Ilya Kochkin, 2021-09-03 16:54:57

How to attach source map to webpack gulp?

Please tell me how to attach sourceMap to webpack-stream module for gulp
here is the task

const webpack = require('webpack-stream')
function scripts() {
    return src(['app/js/*.js', '!app/js/*.min.js'])
        .pipe(
            webpack(
                {
                    mode: 'production',
                    performance: {hints: false},

                    module: {
                        rules: [
                            {
                                test: /\.(js)$/,
                                exclude: /(node_modules)/,
                                loader: 'babel-loader',
                                query: {
                                    presets: ['@babel/env'],
                                    plugins: ["babel-plugin-root-import"]

                                }
                            }
                        ]
                    },

                }
            )
            // .pipe(sourcemaps.init({loadMaps: true}))
        ).on('error', function handleError() {
            this.emit('end')
        })
        // .pipe(sourcemaps.write('.'))
        .pipe(rename('app.min.js'))
        .pipe(dest('app/js'))
        .pipe(browserSync.stream())
}


if you specify the devtool parameter: "source-map", then the output of the beleberd

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question