Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

asset-require-hook

1.0.1 • Public • Published

asset-require-hook

A require hook for importing asset files in runtime.

Features

Allows files required by node that match a given set of extensions to be returned as either a data URI, or a custom filename. Meant be used in conjunction with file-loader or url-loader when building universal apps.

Requirements

Using this tool requires Node.js v0.12.x or higher.

Installation

$ npm install asset-require-hook

Usage

require('asset-require-hook')({
  extensions: ['jpg']
})
 
// const image = require('./icon.jpg');