Does anyone have any advice on how i can load this library using RequireJS? I've tried creating a wrapper (http://requirejs.org/docs/commonjs.html#autoconversion) and converting the module, but am still getting "Error: undefinedModule" in index.js any where "require('./components/xxx/xxxx') is used.
I installed via npm install react-color. I am referencing the /lib directory.
Thanks,
J
What command did you use to convert the module? From what I understand r.js should convert all of the files to have define() wrappers.
Thanks. I think i've gotten this to work now. Initially i used:
node r.js -convert path/to/commonjs/modules/ path/to/output
but after a bit of fooling around with getting things to work, I ended up using a babel command:
babel --plugins transform-es2015-modules-amd src --out-dir lib
Not sure if that was the correct approach..I may visit the r.js command again.
I am trying consume react-color in a <script> tag, because my app is dynamically generated. I've been struggling for two days to find a solution where react-color just assumes it's external dependencies from a global context (react, tinycolor, etc) and runs.
Is there any known command which I can follow? or at least a lead?
[email protected] introduces a minified UMD bundle, you will be able to use that in an AMD project!
You can find it at dist/react-color.min.js when installing.
Most helpful comment
[email protected]introduces a minified UMD bundle, you will be able to use that in an AMD project!You can find it at
dist/react-color.min.jswhen installing.