question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is commonjs2 ?

See original GitHub issue

Sorry if that’s obvious but it’s been eating me for multiple days and even greping commonjs2 through this repository I couldn’t find any obvious information. My google-fu on commonjs2 led me back to https://github.com/webpack/webpack/issues/864 … which was not helpful.

Anyone could explicitely inform me what is commonjs2, the differences with commonjs, and what is the relation with webpack ?

Thanks …

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:86
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

187reactions
sokracommented, May 26, 2015

CommonJs spec defines only exports. But module.exports is used by node.js and many other CommonJs implementations.

commonjs mean pure CommonJs commonjs2 also includes the module.exports stuff.

12reactions
vamsiampolucommented, Jul 31, 2017

Are there other commonjs implementations that do not use module.exports which need to be supported by webpack? Now that I understand what the two options commonjs and commonjs2 are, I would like to understand if there is a practical use case for commonjs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Output - webpack
Wondering the difference between CommonJS and CommonJS2 is? While they are similar, there are some subtle differences between them that are not usually ......
Read more >
Sibelius Seraphini on Twitter: "commonjs vs commonjs2 on ...
CommonJs spec defines only exports. But module.exports is used by node.js and many other CommonJs implementations. commonjs mean pure ...
Read more >
CommonJS - Wikipedia
CommonJS is a project with the goal to establish conventions on the module ecosystem for JavaScript outside of the web browser. The primary...
Read more >
Understanding the Webpack Dynamics | by Param Singh
Support for all popular module systems — ES6, AMD, CommonJS, CommonJS2, UMD. Development tools like Hot reloading, dev server; Code splitting ...
Read more >
Webpack's TemplatePlugin - Tan Li Hau
commonjs2 uses module.exports to export values from a module. In this example, webpack assigns the return value of the IIFE to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found