How to use the webpack-sources.RawSource.prototype function in webpack-sources

To help you get started, we’ve selected a few webpack-sources 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 mzgoddard / hard-source-webpack-plugin / lib / hard-source.js View on Github external
var fromStringWithSourceMap = require('source-list-map').fromStringWithSourceMap;

module.exports = HardSource;

function HardSource(cacheItem) {
  Object.setPrototypeOf(this,
    Object.setPrototypeOf(
      new RawSource(cacheItem.source),
      HardSource.prototype
    )
  );

  // RawSource.call(this, cacheItem.source);
  this.cacheItem = cacheItem;
}
HardSource.prototype = Object.create(RawSource.prototype);
HardSource.prototype.constructor = HardSource;

function fixWebpack1MissingFile(map) {
  if (!map.file) {
    // Copy, delete, and reassign the keys so the object has the keys in the
    // proper order and when stringified will create an identical object to the
    // previous builds.
    var clone = {
      version: map.version,
      file: map.file,
      sources: map.sources,
      sourcesContent: map.sourcesContent,
      mappings: map.mappings,
    };
    delete map.version;
    delete map.file;