Latest Meteor 1.8.1 not compiling with React DND

Hi,

Just tried to use React DND (Drag and Drop) with current Meteor 1.8.1 and getting the following error at transpiling:

Uncaught SyntaxError: Unexpected token export

Looking at the source code it points to this in modules.js

Did not find any solutions on StackOverflow or anywhere else. Did find another person having the same issue here:

( diadama commented 10 days ago

edited

got the same error with react-dnd

On Windows and Mac with the current Meteor version)


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// node_modules/react-dnd/lib/index.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
export * from ‘./common’;
export * from ‘./hooks’;
export * from ‘./decorators’;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

},“common”:{“index.js”:function(){

FYI, Updated to 1.8.2 beta 13 and that does not fail with the same error.

Updated using:

meteor update --release 1.8.2-beta.13

Any news on this?

I’ve got the same probelm

Yes, just update to the latest 1.8.2 beta. Works great!

meteor update --release 1.8.2-beta.16

But what is the actual problem? I’m not keen on using a beta version in production…

EDIT : Alright, I’ve read about the root cause from the links above. I guess I’ll have to go for the beta version then if I don’t want to go for a complicated workaround…

Î tried reintroducing react-dnd package in my Meteor 1.8.1 project (not the beta version) by using the command npm install instead of meteor npm install and, to my great surprise, it doesn’t crash like it used to.

Could anybody explain the difference between the two commands? What could be different under the hood?

EDIT: Nope! I was mistaken. It fails just the same with npm install only…

Just for the record, it happens that React-DnD has a commonJS compatible version react-dnd-cjs with associated cjs backends. Using those allows me to avoid using a beta version of Meteor.

If that is the case, then you might want Meteor to recompile the npm package.

Thanks for your input, I wouldn’t have known. However, the react-dnd-cjs is available directly via NPM, it’s not a hidden export in the repo itself, so I didn’t need to recompile it.

You should generally always use meteor npm install because it will make sure if the package you are installing uses any native modules (like the bcrypt package) it’ll install or build binaries for Meteor’s embedded version of node, instead of whatever you have on your system.