🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

webpack-modernizr-loader

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-modernizr-loader

Get your modernizr build bundled with webpack, use modernizr with webpack easily

5.0.0
latest
Source
npm
Version published
Maintainers
2
Created
Source

webpack-modernizr-loader

NPM version Travis Build Status dependencies Status devDependencies Status

Get your modernizr build bundled with webpack.

Installation

$ npm install webpack-modernizr-loader --save-dev

Usage

Documentation: Using loaders

There are three use case.

  • Using loader options.
const modernizr = require("modernizr");

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        loader: "webpack-modernizr-loader",
        options: {
          // Full list of supported options can be found in [config-all.json](https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json).
          options: ["setClasses"],
          "feature-detects": [
            "test/css/flexbox",
            "test/es6/promises",
            "test/serviceworker"
          ]
          // Uncomment this when you use `JSON` format for configuration
          // type: 'javascript/auto'
        },
        test: /empty-alias-file\.js$/
      }
    ]
  },
  resolve: {
    alias: {
      // You can add comment "Please do not delete this file" in this file
      modernizr$: path.resolve(__dirname, "/path/to/empty-alias-file.js")
    }
  }
};
  • Using config file through alias (supported JavaScript and JSON syntax).
const modernizr = require("modernizr");

.modernizrrc.js

module.exports = {
  options: ["setClasses"],
  "feature-detects": [
    "test/css/flexbox",
    "test/es6/promises",
    "test/serviceworker"
  ]
};

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        loader: "webpack-modernizr-loader",
        test: /\.modernizrrc\.js$/
        // Uncomment this when you use `JSON` format for configuration
        // type: 'javascript/auto'
      }
    ]
  },
  resolve: {
    alias: {
      modernizr$: path.resolve(__dirname, "/path/to/.modernizrrc.js")
    }
  }
};
  • Using config (supported JavaScript and JSON syntax) file directly (see below example how it is use).
const modernizr = require("modernizr");

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        loader: "webpack-modernizr-loader",
        test: /\.modernizrrc\.js$/
        // Uncomment this when you use `JSON` format for configuration
        // type: 'javascript/auto'
      }
    ]
  }
};

Contribution

Feel free to push your code if you agree with publishing under the MIT license.

Changelog

License

Keywords

modernizr

FAQs

Package last updated on 18 Mar 2019

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