Patch for FileLocator and asset scripts not working together
PiperOrigin-RevId: 524320143
This commit is contained in:
parent
e6bb9e29c0
commit
dfc604f500
|
@ -1217,10 +1217,17 @@ export async function createMediaPipeLib<LibType>(
|
||||||
if (!self.ModuleFactory) {
|
if (!self.ModuleFactory) {
|
||||||
throw new Error('ModuleFactory not set.');
|
throw new Error('ModuleFactory not set.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Until asset scripts work nicely with MODULARIZE, when we are given both
|
||||||
|
// self.Module and a fileLocator, we manually merge them into self.Module and
|
||||||
|
// use that. TODO: Remove this when asset scripts are fixed.
|
||||||
|
if (self.Module && fileLocator) {
|
||||||
|
(self.Module as FileLocator).locateFile = fileLocator.locateFile;
|
||||||
|
}
|
||||||
// TODO: Ensure that fileLocator is passed in by all users
|
// TODO: Ensure that fileLocator is passed in by all users
|
||||||
// and make it required
|
// and make it required
|
||||||
const module =
|
const module =
|
||||||
await self.ModuleFactory(fileLocator || self.Module as FileLocator);
|
await self.ModuleFactory(self.Module as FileLocator || fileLocator);
|
||||||
// Don't reuse factory or module seed
|
// Don't reuse factory or module seed
|
||||||
self.ModuleFactory = self.Module = undefined;
|
self.ModuleFactory = self.Module = undefined;
|
||||||
return new constructorFcn(module, glCanvas);
|
return new constructorFcn(module, glCanvas);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user