Closed unlight closed 5 years ago
@joelnet will you fix it?
I have updated this to 2.3.0
which should now support UMD modules.
Can you please test this and verify that it is working for you?
Does not work.
Issue about remote loaded modules, but not this module @paciolan/remote-module-loader
.
createLoadRemoteModule
function should be changed to something like this:
const module = { exports };
new Function('require', 'module', 'exports', code)(requires, module, exports);
return module.exports;
Hmm. I have added the babel plugin @babel/plugin-transform-modules-umd
, which should have handled that.
Do you have some example code that I could use to test this?
Sure, here is the example.
import { createLoadRemoteModule} from '@paciolan/remote-module-loader';
test('umd load', async () => {
const remoteModuleLoader = createLoadRemoteModule();
const result = await remoteModuleLoader('https://unpkg.com/h-document-element@2.0.0/bundles/h-document-element.umd.js');
expect(result.Fragment).toBeDefined();
expect(result.createElement).toBeDefined();
expect(result.h).toBeDefined();
});
AHH Got it. Misunderstanding. I made remove-module-loader
accessible as a UMD. You were referring to loading a UMD.
Now that is cleared up, I can fix the right thing. lol
A fix has been pushed to 2.4.0
d3adef2429da26cbe14b08a895d9e581b79be104 It should fix. Thank you.
UMD (rollup) wrapper could looks like this:
So, checking for
exports
is not enough, need addmodule
in this evalWebpack umd: