Skip to content
Anton edited this page Aug 28, 2019 · 3 revisions

Transforms all export statements into module.exports statements.

Input Output
export async function example () {}

const example2 = () => {}

export default class Example {
  constructor() {
    example()
  }
}

export { example2 as alias }

async function example () {}

const example2 = () => {}

class Example {
  constructor() {
    example()
  }
}



module.exports = Example
module.exports.example = example
module.exports.alias = example2

There are some limitations one should be aware about, however they will not typically cause problems for a Node.JS package. The line and column numbers are preserved for easier generation of the source maps when using the require hook and when source maps are not skipped with -s option. When -s is given, on the other hand, ÀLaMode will remove any unnecessary whitespace that usually fills in the export length.

Clone this wiki locally