question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exclude vendor files from source map

See original GitHub issue

Is it possible to exclude certain files from running through sourcemaps? I.E. I have vendor/some-lib.js and while I want that file included in the build, I don’t want it included in the sourcemap.

Here is my webpack.config.js.

'use strict';

const pkg = require('./package');
const path = require('path');
const webpack = require('webpack');

module.exports = {
    devtool: 'source-map',
    entry: path.join(__dirname, 'src', 'lib.js'),
    target: 'web',
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'charge-xvs.js'
    },
    plugins: [
        new webpack.BannerPlugin('charge-xvs.js | ' + pkg.version, {
            entryOnly: true
        }),
        new webpack.optimize.UglifyJsPlugin({
            sourceMap: true,
            mangle: true
        }),
        new webpack.optimize.DedupePlugin()
    ]
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:40 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
acostafcommented, Jun 29, 2016

@nodesocket @sokra Any update on this?

8reactions
leedoriancommented, Sep 9, 2016

@sky-coding Yeah, using SourceMapDevToolPlugin instead of devtool option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack 5 source maps vendor naming/exclusion
giving an explicit name for the split chunks, it was easy to exclude them splitChunks: { chunks: "all", cacheGroups: { defaultVendors: ...
Read more >
SourceMapDevToolPlugin - webpack
The following code would exclude source maps for any modules in the vendor.js bundle: new webpack.SourceMapDevToolPlugin({ filename: '[file].map[query]', ...
Read more >
SourceMapDevToolPlugin - webpack 3 documentation
This plugin enables more fine grained control of source map generation. It is an alternative to the devtool configuration option. new webpack.
Read more >
Can't collect static files if don't have vendor's JavaScript ...
If one is using 3rd party JavaScript library, its often a minified Javascript file, that quite likely it has a source map url...
Read more >
TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a ... Generates a source map for .d.ts files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found