Skip to content
Custom output format for rollup.
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
package.json
rollup.config.js

README.md

rollup-plugin-output

Custom output format for rollup.

Installation

$ npm install --save-dev rollup-plugin-output

Or

$ yarn add -D rollup-plugin-output

Example

Generate JSON format file

// src/manifest.ts
import * as pkg from "../package.json";

export default {
    name: pkg.name,
    description: pkg.description,
    version: pkg.version,
    app: {
        background: {
            scripts: ["background.js"]
        }
    }
};
// rollup.config.js
import json from "rollup-plugin-json";
import output from "rollup-plugin-output";

const manifest = {
    input: "src/manifest.ts",
    output: {
        file: "dist/manifest.json",
        format: "json"
    },
    plugins: [json(), output()]
};

export default [manifest];
// dist/manifest.json
{
    "name": "shadowsocks-chromeos",
    "description": "",
    "version": "1.0.0",
    "app": {
        "background": {
            "scripts": [
                "background.js"
            ]
        }
    }
}

Advanced Config(Custom output function)

// rollup.config.js
const manifest = {
    input: "src/manifest.ts",
    output: {
        file: "dist/manifest.txt",
        format (code) {
            return "Hello World";
        }
    },
    plugins: [json(), output()]
};
// dist/manifest.txt
Hello World
You can’t perform that action at this time.