Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-file-resolve

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-file-resolve

Rollup plugin to resolve files with custom loaders at build time.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

{
  // Resolve `lmao` from `library.js`
  lmao: "project/library.js",

  // Resolve `myo` from `file.txt` and import it as a string
  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.

FAQs

Package last updated on 21 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc