file-info-loader

1.0.0 • Public • Published

npm version deps

File Info Loader

A loader for webpack that lets you get file as a string as well as file full path.

Install

npm install --save-dev file-info-loader

Usage

Use the loader either via your webpack config, CLI or inline.

Inline

In your application

import txt from 'file-info-loader!./file.txt';
import js from 'file-info-loader!./file.js';
 
console.log(txt);
// {path: 'FULL-FILE-PATH', content: 'FILE RAW CONTENT'}
 
console.log(js);
// {path: 'FULL-FILE-PATH', content: 'FILE RAW CONTENT'}

Via webpack config

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/,
        use: 'file-info-loader'
      }
    ]
  }
}

In your application

import txt from './file.txt';

Maintainers

Vladimir Shafikov

Package Sidebar

Install

npm i file-info-loader

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kersh