Ok. I know the title is blunt and prejudiced.
But I hope it will attract the attention of somebody.
Here is what I want to do.
I want to write
import stuff from 'package'instead ofvar stuff = require('package').
_That's it._
I've tried many, many times to do this in new NodeJS projects, and each time I've eventually given up. Too complex. Unable to make it work. Too much effort. Believe me. Please.
I know that people will tell me that:
esm. Transpilers. --experimental-modules and .mjs files. Others.But sorry, this is not what I want.
I don't want .mjs. I don't want transpilers.
I just want to write plain ES6 Javascript.
And I have the feeling that Node is not allowing me to do that.
That Node is forcing me to stay with that old require syntax.
Please understand that I don't mean to be offensive. I hate people who are not constructive or dismissive of others' efforts and work. And I hate myself for writing such a "I want something" post.
In fact, I have read lots of articles on the topic, including threads here. I do admit that I don't understand half of the issues that are being discussed here by great engineers who have a very thorough understanding of the complexity and intricacies of the module system. I do recognize that it seems to be really, really complex.
But the reality is I am not one of these great engineers. I'm just an average guy who is trying to figure out the simplest path to writing code.
I sincerely apologize for opening a thread with that title. But I am doing it in the hope that somebody will hear me.
we're working quite hard to make sure you can just write import a from 'b'. I'm not sure how mjs factors into that.
I'm going to go ahead and close this as there is not anything actionable here.
@vejja I can appreciate your frustration but I hope you can understand that the approach you have taken here is not particularly productive.
Lots of folks are working very hard on this problem and we hope to have a solution as soon as reasonably possible
OP is saying that they want to be able to write import statements without needing to use the .mjs extension or transpilers or loaders. I think that鈥檚 pretty clear.
@vejja We鈥檙e doing a lot of work to make import and export statements work in .js files. That鈥檚 discussed in https://github.com/nodejs/modules/issues/151 and https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal.
@GeoffreyBooth You got me 100% right.
Sorry for the rant. Clearly not even trying to get productive, as I know that my level of technical understanding is miserable.
I'm just trying to convey a user-based perspective.
Thanks for your considerate feedback @vejja. It's important that we keep our users and their needs front-of-mind. : )
Most helpful comment
Thanks for your considerate feedback @vejja. It's important that we keep our users and their needs front-of-mind. : )