Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rollup-plugin-export-equals

manferlo811.1kMIT0.4.0TypeScript support: included

Transforms export default x or export { x as default } to export = x for CommonJS module type declaration export

rollup, plugin, rollup-plugin, export, exports, equals

readme

rollup-plugin-export-equals

CircleCI npm codecov packagephobia bundlephobia types Known Vulnerabilities license

Transforms export default x or export { x as default } to export = x for CommonJS module type declaration export.

For most applications you won't need this plugin, but it is specially useful after rollup-plugin-dts or rolloup-plugin-typescript2 (maybe others...) if you want to build a CommonJS module.

Install

npm i -D rollup-plugin-export-equals

Usage

with `rollup-plugin-dts@1.x.x`

// rollup.config.js

import dts from 'rollup-plugin-dts';
import equals from 'rollup-plugin-export-equals';

export default {

  input: 'input/index.d.ts',
  output: { file: 'out/index.d.ts', format: 'cjs' },

  plugins: [
    dts(),
    equals(),
  ],

};

with rollup-plugin-typescript2

// rollup.config.js

import ts from 'rollup-plugin-typescript2';
import equals from 'rollup-plugin-export-equals';

export default {

  input: 'src/index.ts',
  output: { file: 'dist/index.js', format: 'cjs' },

  plugins: [
    ts(),
    equals({
      file: 'path/to/index.d.ts'
    }),
  ],

};

Options

file

file: string;

Path to the file which content to be replaced. If provided the plugin will transform the file in-place instead of the bundled output. It will process the file after it has been written to disk. For example after rollup-plugin-typescript2 has written it to disk.

replace

replace: string;
replace: (match: string, captured: string) => string;
default: 'export = $1'

String or function to be passed to code.replace function. $1 refers to the original value captured from export default ....

License

MIT © 2019-2024 Manuel Fernández

changelog

rollup-plugin-export-equals changelog

Version History

0.4.0 (2024-08-22)

⚠ BREAKING CHANGES

  • Plugin and types are now named exports no default export

Features

  • replace "export { value as default }" (3155568)

0.3.7 (2020-10-23)

Bug Fixes

  • Replace anything after "export default" (81b6ca4)

0.3.6 (2020-03-12)

0.3.5 (2019-09-15)

  • dependencies updated

0.3.4 (2019-08-29)

  • dependencies updated

0.3.3 (2019-07-14)

  • dependencies updated
  • esModule & interop

0.3.2 (2019-07-07)

  • dependencies updated

0.3.1 (2019-06-30)

  • dependencies updated
  • ts-jest for typescript test
  • added husky

0.3.0 (2019-06-22)

0.2.4 (2019-06-07)

  • rolled back to rollup-plugin-dts@^0.15.1
  • documentation improved

0.2.3 (2019-06-07)

  • dependencies updated

0.2.2 (2019-06-01)

  • dependencies updated
  • changelog improved

0.2.1 (2019-05-24)

  • dependencies updated

0.2.0 (2019-05-22)

  • dependencies updated
  • added file mode

0.1.3 (2019-04-25)

  • fixed: broken test

0.1.2 (2019-04-25)

  • dependencies updated

0.1.1 (2019-04-23)

  • improved documentation
  • switched to bundlib

0.1.0 (2019-04-23)

  • coverage threshold

0.0.3 (2019-04-22)

  • fixed keyword

0.0.2 (2019-04-22)

  • added badges
  • added greenkeeper
  • upload coverage

0.0.1 (2019-04-22)

  • preliminary release