rollup-plugin-file-resolve
Rollup plugin to resolve files with custom loaders at build time.
Installation
npm:
npm i rollup-plugin-file-resolve -D
yarn:
yarn add rollup-plugin-file-resolve -D
pnpm:
pnpm add rollup-plugin-file-resolve -D
Usage
Checkout the Example
Options
[alias]
Type: text | object
Determines from where to resolve the specific file.
Available built-in loaders: text
For example:
{
lmao: "project/library.js",
myo: {
path: "project/file.txt",
loader: "text"
}
}
Example output:
var lmao = "Random ahh file";
function myo(text) {
console.log(text);
}
Custom loaders
Using your own custom loader is very simple, just replace the loader
prop with a function.
Here is an example:
myo: {
path: "project/file.txt",
loader: async (code) => await transform(code)
}
The loader function can be both sync or async.
Exports
loaders
Returns: Object of default loaders:
{
text: (code) => code;
}
Information
Resources
Made by Angelo II
Copyright © (C) Angelo II, MIT license.