GithubHelp home page GithubHelp logo

Comments (8)

bennycode avatar bennycode commented on August 21, 2024 82

Using webpack 2.1.0-beta.21, I needed to set sourceMap: true on webpack.optimize.UglifyJsPlugin AND devtool: 'source-map'.

So in the end my configuration looked like this:

webpack.config.js

var webpack = require('webpack');

module.exports = {
  devtool: 'source-map',
  entry: {
    filename: './build/proteus.js'
  },
  output: {
    filename: 'proteus-bundle.js',
    library: 'proteus',
    libraryTarget: 'amd',
    path: './dist'
  },
  node: {
    fs: 'empty',
    crypto: 'empty'
  },
  externals: {
    'libsodium-native': 'libsodium_native'
  },
  plugins: [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {warnings: false},
      output: {comments: false},
      sourceMap: true
    })
  ]
};

from webpack-stream.

kisenka avatar kisenka commented on August 21, 2024 4

It doesn't work with devtool: 'cheap-module-source-map'

from webpack-stream.

shama avatar shama commented on August 21, 2024 2

@plantain-00 Try using webpack's source map setting instead:

.pipe(webpack({
  plugins: [
    new webpack.webpack.optimize.UglifyJsPlugin({ minimize: true })
  ],
  devtool: 'source-map'
}))

Here are docs on more options with webpack's devtool: https://webpack.github.io/docs/configuration.html#devtool

from webpack-stream.

shama avatar shama commented on August 21, 2024

webpack will output multiple destination files. Are you sure .pipe(rename("index.min.js")) isn't just renaming both of the output files to index.min.js by mistake?

from webpack-stream.

plantain-00 avatar plantain-00 commented on August 21, 2024

@shama rename does not change this situation:

gulp.task('test', function() {
    gulp.src('frontends/scripts/index.js')
        .pipe(webpack({
            plugins: [
                new webpack.webpack.optimize.UglifyJsPlugin({ minimize: true, sourceMap: true })
            ]
        }))
        //.pipe(rename("index.min.js"))
        .pipe(gulp.dest('frontends/build/scripts/'));
});

There is only one file named 10fedf2665417c01a8c3.js, minified properly, no source map file, no //# sourceMappingURL=XXXX.map in 10fedf2665417c01a8c3.js.

from webpack-stream.

plantain-00 avatar plantain-00 commented on August 21, 2024

@shama it works, thanks.

from webpack-stream.

shankie-codes avatar shankie-codes commented on August 21, 2024

Hmmm I'm having the same issue, but when using webpack straight up, rather than in Gulp. I've tried all the solutions listed here, but to no avail!

I'll report back here if I discover anything...

from webpack-stream.

alfondotnet avatar alfondotnet commented on August 21, 2024

sourceMaps config parameter is now false by default
https://gist.github.com/sokra/27b24881210b56bbaff7#gistcomment-1863573

from webpack-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.