Skip to content

Instantly share code, notes, and snippets.

@Randy808
Randy808 / compilation-addEntry.js
Last active February 23, 2021 11:09
compilation-addEntry.js
/**
* @param {string} context context path for entry
* @param {Dependency} entry entry dependency that should be followed
* @param {string | EntryOptions} optionsOrName options or deprecated name of entry
* @param {ModuleCallback} callback callback function
* @returns {void} returns
*/
addEntry(context, entry, optionsOrName, callback) {
// TODO webpack 6 remove
const options =
var hook = new SyncHook();
hook.tap("callback", () => "hello")
hook.call();
@Randy808
Randy808 / hook.js
Created September 27, 2020 22:25
Toy hook example for medium article.
class Hook {
constructor(){
this.hookedFunctions = [];
}
hookFunction(functionToHook){
this.hookedFunctions.push(functionToHook);
}
callHook(){