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

The whole .mjs pattern is flawed #237

@vejja

Description

@vejja

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions