Leonardo is not working with AMD, CommonJS, and UMD module
hawckins opened this issue · comments
Description
We are working on project which built on Asynchronous Module Definition (AMD). When I try to use leonardo in AMD the API is not working. Any help to implement this? Tried so many different things but not able to make it.
Steps to reproduce
Package under the @adobe namespace that does have type definitions? The leornado module not only doesn't have type definitions, it is also not set up for use in AMD
Expected behavior
define(['@adobe/leonardo-contrast-colors'], function (generateAdaptiveTheme) {
// methods
function myFunc(){
...
return generateAdaptiveTheme({colorScales, baseScale, brightness});
};
return myFunc;
});
Screenshots
Leonardo package and version
Environment
- Browser(s) and OS(s):
Additional context
It sounds like you're using RequireJS, right?
With ES6's imports, the UMD pattern is no longer required. You should be using a transpiler to make your project work with modern module definitions. Have you tried using @babel/plugin-transform-modules-umd?
A quick google returns lots of results like this StackOverflow post.
Please file a separate issue for type definitions.
Also, please fill out the rest of the issue template, it's the kind thing to do <3
Yeah correct we are using RequireJs, as you said I will be closing this bug and created an enhancement for type definition
#107
@hawckins cool, did the usage of @babel/plugin-transform-modules-umd
solve this issue for you?