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 type field and .node #474

Closed
Closed
@jkrems

Description

@jkrems

So far we've told people that type can be used to switch how .js is interpreted. In nodejs/node#31388 @bmeck pointed out that setting it to module also has side-effects on how .node is interpreted. To me that sounds really counter-intuitive and surprising. Are there any meeting notes for this? Right now I would consider it a bug that's worth fixing.

For reference, this is the current effective extension map delta:

const typeModule = {
  '': 'module',
  '.js': 'module',
  '.node': 'error',
};

const typeCommonJS = {
  '': 'commonjs',
  '.js': 'commonjs',
  '.node': 'commonjs',
};

I'm omitting .json because with experimental JSON modules the difference goes away. But without the flag, it is also affected by type.

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