@tarojs/mini-runner
Version:
Mini app runner for taro
26 lines • 1.18 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const TaroSingleEntryDependency_1 = require("../dependencies/TaroSingleEntryDependency");
class TaroSingleEntryPlugin {
constructor(context, entry, name, miniType) {
this.context = context;
this.entry = entry;
this.name = name;
this.miniType = miniType;
}
apply(compiler) {
compiler.hooks.compilation.tap('TaroSingleEntryDependency', (compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(TaroSingleEntryDependency_1.default, normalModuleFactory);
});
compiler.hooks.make.tapAsync('SingleEntryPlugin', (compilation, callback) => {
const { entry, name, context, miniType } = this;
const dep = TaroSingleEntryPlugin.createDependency(entry, name, miniType);
compilation.addEntry(context, dep, name, callback);
});
}
static createDependency(entry, name, miniType) {
return new TaroSingleEntryDependency_1.default(entry, name, { name }, miniType);
}
}
exports.default = TaroSingleEntryPlugin;
//# sourceMappingURL=TaroSingleEntryPlugin.js.map
;