Hi
I’m following the guide at http://react-in-meteor.readthedocs.org/en/latest/client-npm/ and I tried adding react-dragula (https://www.npmjs.com/package/react-dragula) to my app.
I’ve done meteor add meteorhacks:npm cosmos:browserify
My packages.json
{
"externalify": "0.1.0",
"react-dragula": "1.0.2"
}
app.browserify.js
dragula = require('react-dragula');
app.browserify.options.json
{
"transforms": {
"react-dragula": {
"global": true,
"external": {
"react": "React.require"
}
}
}
}
But I get the following error:
C:\dev\tren-backend\packages\npm-container\.npm\package\node_modules\react-dragula\node_modules\dragula\node_modules\crossvent\node_modules\custom-event\index.js:24
'function' === typeof document.createEvent ? function CustomEvent (type, param
^
ReferenceError: document is not defined
At first I was thinking this was because document isn’t available on server so I moved it from /lib
to /client
but I still get the same error. Do I have to transform it with something else?
Edit: Trying instead with react-dnd
I get this error:
While building the application:
lib\browserify\app.browserify.js: Unexpected object exported by the
"C:\\dev\\tren-backend\\packages\\npm-container\\.npm\\package\\node_modules\\react-dnd\\modules\\index.js"
package. Expected a transform function.
Edit2: I removed the app.browserify.options.json
and this makes react-dnd
work (but not react-dragula
). Will this be bad for my code?
Cheers