Open ssylvia opened 7 years ago
Hi @ssylvia,
It looks like the library uses UMD: https://github.com/ericelliott/cuid/blob/master/dist/browser-cuid.js#L102.
That doesn't actually look like standard UMD to me — I'm not sure what module format that app.register
call aligns with, but AMD (which is the arm of a UMD setup that would work with Ember's loader.js
) would have a define()
call somewhere.
Do I need to do anything else to make it work with
import cuid from 'cuid'; const myId = cuid();
To make the import
call work rather than relying on the global, you can use ember generate vendor-shim cuid
. Based on your snippet, I think the generator output should give you exactly what you need without any tweaking 🙂
I'm attempting to use the CUID id generator library. I am able to import the library into the vendor folder with this addon, but everything I try loads the load the library as a global variable.
It looks like the library uses UMD: https://github.com/ericelliott/cuid/blob/master/dist/browser-cuid.js#L102. Do I need to do anything else to make it work with
instead of