Velcro.Runtime package out of date?
See original GitHub issueHi,
Just trying to assemble the bundler for a project alongside the runtime (using the published npm packages), but I am hitting a few bumps with respect to their being inconsistencies between the expected resolverHost for @velcro/runtime and the actual resolverHost in @velcro/resolver-host-compound. (isCacheable seems to be missing in newer).
Looking at the versions, it does appear that @velcro/runtime is the only package that hasn’t been updated, so perhaps the types are just out of sync and the core runtime needs releasing? If not perhaps I am assembling these packages incorrectly, in which case perhaps you could point me in the right direction?
While I am at it, I am also not 100% sure what the best approach is for substituting real packages with the runtime.
Currently I am doing something along the lines of:
` const memoryHost = new Velcro.ResolverHostMemory( initialFiles, “compound_host_with_cache” ); const resolverHostUnpkg = new VelcroResolverHostUnpkg.ResolverHostUnpkg(); const resolverHost = new VelcroResolverHostCompound.ResolverHostCompound({ “https://unpkg.com/”: resolverHostUnpkg as any, [memoryHost.urlFromPath(“/”).href]: memoryHost });
const runtime = Velcro.createRuntime({ cache: _cache, injectGlobal: Velcro.injectGlobalFromUnpkg, resolveBareModule: async (a, b, name, d) => { if (name === “react”) return memoryHost.urlFromPath(“/react”).href; if (name === “react-dom”) return memoryHost.urlFromPath(“/react-dom”).href; if (name === “prop-types”) return memoryHost.urlFromPath(“/prop-types”).href;
const res = await Velcro.resolveBareModuleToUnpkg(a, b, name, d);
return res;
},
resolverHost,
rules: [
...
]
}
]
}); `
And then after assembling, I can do the following:
runtime.set(memoryHost.urlFromPath("/react").href, React); runtime.set(memoryHost.urlFromPath("/react-dom").href, ReactDom);
Although this might work, it doesn’t seem to be consistent with the bundler api, and also it doesn’t work for underlying webpack plugins like css-loader or style-loader. It would be nice to do this because stuff like sass-loader has tons of dependencies and is slow on first pass.
Any thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (15 by maintainers)
Top GitHub Comments
Awesome. Will have a crack at getting this integrated next week.
Thanks again, really appreciate the work your doing 👍