Rollup plugin that inliing fs.readFile contents.
MIT License
Rollup plugin that inliing fs.readFile
contents.
This plugin use browserify/brfs. It supports that
fs.readFileSync(pathExpr, enc=null)
fs.readFile(pathExpr, enc=null, cb)
fs.readdirSync(pathExpr)
fs.readdir(pathExpr, cb)
browserify/brfs does not support ES module.
import fs from "fs";
const text = fs.readFileSync(__dirname + "/readme.md", "utf-8");
console.log(text);
It does not inlined.
If you used babel, babel-plugin-static-fs will resolve it.
Install with npm:
npm install rollup-plugin-brfs
// rollup.config.js
import brfs from 'rollup-plugin-brfs';
export default {
input: 'src/main.js',
output: {
file: 'dist/bundle.js',
format: 'iife'
},
plugins: [
brfs()
]
};
export type rollupBrfsOptions = {
// Default: [".js", ".jsx", ".ts", ".tsx"]
extensions?: string[]
// https://github.com/browserify/brfs#var-tr--brfsfile-opts
brfsOptions?: {}
}
See Releases page.
Install devDependencies and Run npm test
:
npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © azu