Skip to content

Instantly share code, notes, and snippets.

@pmdartus
Created August 19, 2020 15:13
Show Gist options
  • Save pmdartus/2809d4104bad411d4779edc9a18ebc8a to your computer and use it in GitHub Desktop.
Save pmdartus/2809d4104bad411d4779edc9a18ebc8a to your computer and use it in GitHub Desktop.
AMD Loader example
<!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