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.

Support for Node.js style module.exports

See original GitHub issue

As of Node.js 4.2.0 and 5.0.0, much of the desired ES6 functionality many developers have without the need for using tools such as babel. However, Node.js does not yet support ES6 module syntax (any may never support it). But we, and I’m sure many others, would love to use esdoc with native ES6 on Node 4.2.0/5.0.0.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
nashton109commented, Jan 5, 2016

To get this working for one of my projects, i have a very quick and dirty plugin which is included in via the plugins config in my esdoc file:

exports.onHandleCode = function (ev) {
  ev.data.code = ev.data.code
    .replace(/module\.exports = /g, 'export default ')
    .replace(/exports = /g, 'export default ');
};
0reactions
thetutlagecommented, Feb 4, 2016

@Orgun109uk Same does not work with

exports = module.exports = {}

As it fails even before reaching the onHandleCode

Read more comments on GitHub >

github_iconTop Results From Across the Web

CommonJS modules | Node.js v19.3.0 Documentation
The module.exports property can be assigned a new value (such as a function or object). Below, bar.js makes use of the square module,...
Read more >
Node Module Exports Explained - freeCodeCamp
There's another way of exporting from a Node.js module called "named export". Instead of assigning the whole module.exports to a value, we would ......
Read more >
Use Module.exports to Keep Node.js Code Organized - Medium
We can assign an object, a single function, or any value to module. exports to be used again in another file. This is...
Read more >
How to use module.exports in Node.js - Stack Abuse
The use of module.exports allows us to export values, objects and styles from Node.js modules. Coupled with the use of require to import...
Read more >
Node.js Module Exports Explained | Scout APM Blog
This post will cover the use of modules in Node.js, what they are, why they are essential, and how to export and import...
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