Nefarious Plastic Mannequins

    oneof-loader
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    oneof-loader

    Oneof loader for webpack loaders select, the options similar with builtin oneOf, An array of loaders from which only the first matching loaders is used when the conditions matches.

    Installation

    yarn add oneof-loader -D --production=false

    Usage

    Within your webpack configuration object, you'll need to add the oneof-loader to the list of modules, like so:

    module: {
      rules: [
        {
          test: /\.svg$/,
          use: {
            loader: 'oneof-loader',
            options: {
              oneOf: [
                {
                  test: /\/src\/assets\/icons\/svg\//,
                  loader: 'svg-sprite-loader',
                  options: {
                    symbolId: 'icon-[name]',
                    extract: false
                  }
                },
                {
                  test: /\/src\//,
                  loader: 'vue-svg-loader'
                },
                {
                  loader: 'svg-url-loader',
                  options: {
                    stripdeclarations: true,
                    limit: 1024,
                    name: 'img/[name].[hash:8].[ext]'
                  }
                }
              ]
            }
          }
        }
      ]
    }
    
    

    License

    MIT Copyright (c) Allex Wang

    Install

    npm i oneof-loader

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    6.63 kB

    Total Files

    4

    Last publish

    Collaborators

    • allex