Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

The whole .mjs pattern is flawed #237

Closed
vejja opened this issue Dec 13, 2018 · 5 comments
Closed

The whole .mjs pattern is flawed #237

vejja opened this issue Dec 13, 2018 · 5 comments

Comments

@vejja
Copy link

vejja commented Dec 13, 2018

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 of var 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:

  • There are very good reasons why it is not possible. Async vs sync. Interoperability. Many other considerations.
  • There are already many ways to make it work. 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.

@devsnek
Copy link
Member

devsnek commented Dec 13, 2018

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.

@MylesBorins
Copy link
Contributor

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

@GeoffreyBooth
Copy link
Member

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’s pretty clear.

@vejja We’re doing a lot of work to make import and export statements work in .js files. That’s discussed in #151 and https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal.

@vejja
Copy link
Author

vejja commented Dec 13, 2018

@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.

@zenparsing
Copy link

Thanks for your considerate feedback @vejja. It's important that we keep our users and their needs front-of-mind. : )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants