0.0.4 • Published 4 years ago

@qpitlove/rollup-plugin-input-through v0.0.4

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

rollup-plugin-input-through

npm.io

Pass the input as output without build output options

Installation

npm install --save-dev @qpitlove/rollup-plugin-input-through

Usage

Generally, you need to ensure that rollup-plugin-input-through goes before other things (like rollup-plugin-html2) in your plugins array.

// rollup.config.js
import fg from "fast-glob";
import inputThrough from "@qpitlove/rollup-plugin-input-through";
import html2 from "rollup-plugin-html2";

export default [{
  input: fg.sync(["src/*.js"]),
  plugins: [
    inputThrough({
      // input: ['src/mainA.js', 'src/mainB.js'],
      // output: ['dist/mainA.js', 'dist/mainB.js'],
      input: (val) => val.replace("src/", "dist/"),
    }),
    html2({
      template: "src/index.html",
      fileName: "index.html",
      onlinePath: "."
    }),
  ],
}];

Options

{
  // `string: (path) => replacement` functions...
  input: (id) => `'${path.dirname(id)}'`,
}

License

MIT