Skip to main content
typo
Source Link
bernie
  • 10.5k
  • 7
  • 67
  • 99

Update: April 2022

The module field is not officially defined by Node.js and support is not planned. Instead, the Node.js community settled on package exports which they believe is more versatile.

For practical reasons JavaScript bundlers will continue to be support the module field. The esbuild docs explain when to use module as well as related fields main and browser.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it.

Update: April 2022

The module field is not officially defined by Node.js and support is not planned. Instead, the Node.js community settled on package exports which they believe is more versatile.

For practical reasons JavaScript bundlers will continue to be support the module field. The esbuild docs explain when to use module as well as related fields main and browser.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it.

Update: April 2022

The module field is not officially defined by Node.js and support is not planned. Instead, the Node.js community settled on package exports which they believe is more versatile.

For practical reasons JavaScript bundlers will continue to support the module field. The esbuild docs explain when to use module as well as related fields main and browser.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it.

be less node.js centric
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78

Update: April 2022

As of today, thisThe module field is not officially defined by Node.js and will not be supported in futuresupport is not planned. Instead, we now have package exports which is more versatile. You can use those to define both CommonJS modules and ES Modulesthe Node. You canjs community settled on read more about it herepackage exports which they believe is more versatile.

However, forFor practical purposes, it wouldreasons JavaScript bundlers will continue to be supported by most ofsupport the JavaScript bundlersmodule field. The esbuild docs explain when to use module as well as related fields main and browser.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it. The esbuild docs explain when to use module as well as related fields main and browser.

Update: April 2022

As of today, this field is not officially defined by Node.js and will not be supported in future. Instead, we now have package exports which is more versatile. You can use those to define both CommonJS modules and ES Modules. You can read more about it here.

However, for practical purposes, it would continue to be supported by most of the JavaScript bundlers.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it. The esbuild docs explain when to use module as well as related fields main and browser.

Update: April 2022

The module field is not officially defined by Node.js and support is not planned. Instead, the Node.js community settled on package exports which they believe is more versatile.

For practical reasons JavaScript bundlers will continue to be support the module field. The esbuild docs explain when to use module as well as related fields main and browser.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it.

Updated the answer to reflect updated information
Source Link
Harshal Patil
  • 21.5k
  • 17
  • 76
  • 156

Update: April 2022

As of today, this field is not officially defined by Node.js and will not be supported in future. Instead, we now have package exports which is more versatile. You can use those to define both CommonJS modules and ES Modules. You can read more about it here.

However, for practical purposes, it would continue to be supported by most of the JavaScript bundlers.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it. The esbuild docs explain when to use module as well as related fields main and browser.

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it. The esbuild docs explain when to use module as well as related fields main and browser.

Update: April 2022

As of today, this field is not officially defined by Node.js and will not be supported in future. Instead, we now have package exports which is more versatile. You can use those to define both CommonJS modules and ES Modules. You can read more about it here.

However, for practical purposes, it would continue to be supported by most of the JavaScript bundlers.

Original Answer

Is "module" an official npm property or is this a convention of some kind?

It's a proposal, but likely to be supported due to de facto usage.

Is there documentation for this somewhere?

There is, in fact, and it can be found right here and later removed here.

What's it for?

ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it. The esbuild docs explain when to use module as well as related fields main and browser.

add link to esbuild docs
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Rollback to Revision 12
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Rollback to Revision 8
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
node made a mistake, mime types aren't going to change
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
words and stuff
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
No one knows the future
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Add link to the --mode propsal
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
wordsmithing
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
because node
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
deleted 4 characters in body
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
add Rich Harris blog post
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Update answer
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
added 94 characters in body
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Link to In Defense of Dot JS
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading
Source Link
vhs
  • 10.2k
  • 3
  • 73
  • 78
Loading