How to use the webpack-bundle-tracker.prototype function in webpack-bundle-tracker

To help you get started, we’ve selected a few webpack-bundle-tracker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github harvard-lil / capstone / capstone / vue.config.js View on Github external
const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');

/*** helpers ***/

const devMode = process.env.NODE_ENV !== 'production';

// BundleTracker includes absolute paths, which causes webpack-stats.json to change when it shouldn't.
// We use this RelativeBundleTracker workaround via https://github.com/owais/webpack-bundle-tracker/issues/25
const RelativeBundleTracker = function(options) {
    BundleTracker.call(this, options);
};
RelativeBundleTracker.prototype = Object.create(BundleTracker.prototype);
RelativeBundleTracker.prototype.writeOutput = function(compiler, contents) {
  if(contents.chunks){
    const relativePathRoot = path.join(__dirname) + path.sep;
    for(const bundle of Object.values(contents.chunks)){
      for(const chunk of bundle){
        if (chunk.path.startsWith(relativePathRoot)) {
          chunk.path = chunk.path.substr(relativePathRoot.length);
        }
      }
    }
  }
  BundleTracker.prototype.writeOutput.call(this, compiler, contents);
};

/*** Vue config ***/
let devServerHost = process.env.DOCKERIZED ? '0.0.0.0' : '127.0.0.1';
github harvard-lil / capstone / capstone / vue.config.js View on Github external
RelativeBundleTracker.prototype.writeOutput = function(compiler, contents) {
  if(contents.chunks){
    const relativePathRoot = path.join(__dirname) + path.sep;
    for(const bundle of Object.values(contents.chunks)){
      for(const chunk of bundle){
        if (chunk.path.startsWith(relativePathRoot)) {
          chunk.path = chunk.path.substr(relativePathRoot.length);
        }
      }
    }
  }
  BundleTracker.prototype.writeOutput.call(this, compiler, contents);
};

webpack-bundle-tracker

Spits out some stats about webpack compilation process to a file

MIT
Latest version published 1 month ago

Package Health Score

78 / 100
Full package analysis