Skip to content

OriR/interpolate-loader-options-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interpolate-loader-options-webpack-plugin

Webpack plugin to interpolate strings within loader options.

Install

npm install --save-dev interpolate-loader-options-webpack-plugin

Usage

Once installed, can be used in your webpack configuration file

const InterpolateLoaderOptionsPlugin = require('interpolate-loader-options-webpack-plugin');

module.exports = {
  ...
  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
        {
          loader: 'my-loader',
           options: {
             value: 123,
             interpolated: '[name]'
             nested: {
               arrays:[
                 {
                   value:'sdff'
                 },
                 {
                   value: '[path]'
                 }
               ]
             }
           }
         }
        ]
      }
    ]
  }
  plugins: [
    ...
    new InterpolateLoaderOptionsPlugin({
      // Optional Array<Object>
      loaders: [{
        // Required String
        name: 'my-loader',

        // Optional Array<String>
        include: ['nested.arrays.1.value']
      }]
    })
  ]
};

options

loaders Array<Object>

This property is optional.
Defines an array of loader configurations on how to interpolate each loader.
Each loader configuration must have a name that corresponds to a name of a loader.
Each loader configuration can have an include array of property paths within the options that need to be interpolated.

About

Webpack plugin to interpolate options for webpack loaders

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published