Import, export, etc commands in node_modules not understood

Hello.

I have seen that the packages in node_modules I am using use “const xx = require(‘yy’)”.
But I have one (vuetify) which uses “import …” and that fails.

Any idea how to solvel this issue?

thanks.

Meteor used to automatically compile every package in node_modules , but since most apps now rely on more and more modules, that was taking a long time to do, and almost all modules on npm publish pre-compiled code that works natively on node and in the browser.

For the few packages that don’t, this change means these packages that magically worked before, now don’t.

There is a method to manually opt into compilation of individual modules if this is the cause of your problem. You can symbolically link the folder into your imports directory so the build tool queues it for compilation, and it will bundle the compiled version for your app to use.
Alternatively, you can copy the files into your project and they will be compiled

The full details are in this pull request: https://github.com/meteor/meteor/pull/9771

An easier way to opt-in to module compilation is coming in the next update (can’t remember if it’s in 1.8.2 or 1.9), where you add the module name to package.json.

2 Likes

It’s coming in 1.8.2, the easier way to opt-in node_module compilation is detailed in this pull request.

1 Like

Thanks for your answers.

Yesterday I tried both methods to have the code compiled, and it compiled it BUT the internal links didn’t work.

Right now I am studying graphql-apollo (maybe including now nuxt once I study it) to move away from meteor. It has been extremely painful (several weeks without writing a line of code).

Even if meteor 1.8.2 solve this problem I hope I adapt my app out of meteor cause I don’t want to be again in this terrible situation.

Thanks.

Yeah Nuxt could be easier for you since everything is integrated however it is less flexible than Meteor and framework is less mature.

However, there is a certain inherited complexity when dealing with open source and nodejs ecosystem specifically given the large number of micro-libraries that need to be integrated to create any decent web app. Hopefully you’ll never run into issues like these because they take the fun away but I’d recommend maintaining a high level of resilience and perseverance regardless of the framework/tool when creating a web apps/software because I honestly have never seen a journey toward any decent size software without its share of accidental complexities.

Good luck.

1 Like

Thanks alawi.

I know that meteor is quite powerful. I have enjoyed a lot its total reactivity.
But imagine having your app down several weeks cause a library won’t compile and when it does it doesn’t work.
I know I’ll have to learn plenty of extra details that Meteor did transparently. I have no choice anyway cause still vuetify doesn’t work with meteor.

Cheers.

I’m sure there is a way to make it work but I’m a react/blaze user so I can’t help you with that. Hopefully a vue user can chime in, you might have better luck posting in the vue section and asking for help in that specific integration.

Cheers.