rollup-plugin-direct-import
v1.0.0
Published
Rollup plugin to import code from config at built time.
Downloads
7
Readme
rollup-plugin-direct-import
Rollup plugin to import code from config at built time.
Installation
npm:
npm i rollup-plugin-direct-import -D
yarn:
yarn add rollup-plugin-direct-import -D
pnpm:
pnpm add rollup-plugin-direct-import -D
Usage
import directImport from "rollup-plugin-direct-import";
export default {
input: "src/index.js",
output: {
dir: "output",
format: "cjs"
},
plugins: [
directImport({
stuff: {
value: "lego",
type: "text"
},
data: {
value: "export default { fun: true };",
type: "code"
}
})
]
};
src/index.js
import stuff from "stuff";
import data from "data";
console.log("I was doing", stuff);
console.log(data);
output/index.js
var stuff = "lego";
var data = { fun: true };
console.log("I was doing", stuff);
console.log(data);
Options
[import]
Type: { value: any; type: "code" | "text"; }
Information
Resources
Made by Angelo II
Copyright © (C) Angelo II, MIT license.