Created
August 19, 2020 15:13
-
-
Save pmdartus/2809d4104bad411d4779edc9a18ebc8a to your computer and use it in GitHub Desktop.
AMD Loader example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js" integrity="sha512-vRqhAr2wsn+/cSsyz80psBbCcqzz2GTuhGk3bq3dAyytz4J/8XwFqMjiAGFBj+WM95lHBJ9cDf87T3P8yMrY7A==" crossorigin="anonymous"></script> | |
<script> | |
define('lightning-button', [], function() { | |
return { | |
foo: 1 | |
} | |
}); | |
define('lwc-engine', [], function(foo) { | |
return { | |
renderComponent(cmp) { | |
console.log('render', cmp) | |
} | |
} | |
}); | |
requirejs(['lwc-engine', 'lightning-button'], | |
function (lwc, button) { | |
lwc.renderComponent(button); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment