google-fonts-plugin
Version:
Webpack plugin that downloads fonts from Google Fonts and encodes them to base64.
24 lines • 963 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const crypto_1 = require("crypto");
const RawModule = require('webpack/lib/RawModule'); // eslint-disable-line @typescript-eslint/no-var-requires
class Chunk {
constructor(compilation, name) {
this.create = () => {
const chunk = this.compilation.addChunk(this.name);
const webpackModule = new RawModule('', `${this.name}-module`);
webpackModule.buildInfo = {};
webpackModule.buildMeta = {};
webpackModule.hash = '';
return chunk.addModule(webpackModule);
};
this.get = () => this.compilation.namedChunks.get(this.name);
this.compilation = compilation;
this.name = name;
}
}
exports.default = Chunk;
Chunk.hash = (options) => crypto_1.createHash('sha1')
.update(JSON.stringify(options))
.digest('hex');
//# sourceMappingURL=Chunk.js.map