1.1.0 • Published 3 years ago

typescript-fs-read-loader v1.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

Webpack loader for inlining fs.readFileSync calls

This loader uses the Typescript compiler API to find fs.readFileSync calls and inlines the file's contents as strings in the built bundle. You must use a filepath that is relative to the typescript file's __dirname for the loader to work:

import { readFileSync } from "fs";

const file = readFileSync(__dirname + "/path/to/file.txt");