0.3.7 • Published 4 years ago

rollup-plugin-export-equals v0.3.7

Weekly downloads
546
License
MIT
Repository
github
Last release
4 years ago

rollup-plugin-export-equals

CircleCI npm codecov dependencies dev dependencies peer dependencies packagephobia bundlephobia types Known Vulnerabilities license

Transforms export default something to export = something 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 your want to build a CommonJS module.

Install

npm i -D rollup-plugin-export-equals

Usage

with rollup-plugin-dts@0.x.x

// rollup.config.js
import { dts } from "rollup-plugin-dts";
import equals from "rollup-plugin-export-equals";

export default {

  input: "src/index.ts",
  output: { file: "index.d.ts", format: "es" },

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

}

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: "es" },

  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({
      // ... rollup-plugin-typescript2 options
    }),
    equals({
      file: "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 writen to disk. For example after rollup-plugin-typescript2 has written it to disk.

replace

replace: string;
replace: (...args: any[]) => 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 © Manuel Fernández

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago