mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-07 11:38:32 +00:00
More webpack 4 code. Make sure to asynchronously await the availability of our webpack hook everywhere that we use it that it's reasonable to wait.
This adds a new module called switchboard that abuses the root React Router instance to forcibly load a chunk, letting us grab `require()` quickly rather than waiting potentially forever for another chunk to be loaded due to user action, etc.
This commit is contained in:
parent
194f93414d
commit
86c5fee033
13 changed files with 128 additions and 24 deletions
|
@ -402,8 +402,9 @@ export class Module extends EventEmitter {
|
|||
}
|
||||
|
||||
|
||||
inject(name, module) {
|
||||
inject(name, module, require = true) {
|
||||
if ( name instanceof Module || name.prototype instanceof Module ) {
|
||||
require = module != null ? module : true;
|
||||
module = name;
|
||||
name = null;
|
||||
}
|
||||
|
@ -447,7 +448,8 @@ export class Module extends EventEmitter {
|
|||
if ( ! module )
|
||||
throw new Error(`cannot find module ${name} or no module provided`);
|
||||
|
||||
requires.push(module.abs_path('.'));
|
||||
if ( require )
|
||||
requires.push(module.abs_path('.'));
|
||||
|
||||
if ( this.enabled && ! module.enabled )
|
||||
module.enable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue