webpack-genius
Version:
**For chinese developers:** you'd better add taobao mirror before everything start. Or you may fail to install. ```bash yarn config set registry http://registry.npm.taobao.org ```
32 lines (31 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Preload = void 0;
var tslib_1 = require("tslib");
var PluginHandle_1 = require("./PluginHandle");
var preload_webpack_plugin_1 = tslib_1.__importDefault(require("preload-webpack-plugin"));
var Preload = /** @class */ (function (_super) {
tslib_1.__extends(Preload, _super);
function Preload() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.rel = 'prefetch';
return _this;
}
Preload.prototype.usePreload = function () {
this.rel = 'preload';
return this;
};
Preload.prototype.usePrefetch = function () {
this.rel = 'prefetch';
return this;
};
Preload.prototype.collect = function () {
return [
new preload_webpack_plugin_1.default({
rel: this.rel,
}),
];
};
return Preload;
}(PluginHandle_1.PluginHandle));
exports.Preload = Preload;