Detalhes do pacote

webpack-modernizr-loader

itgalaxy30.4kMIT5.0.0

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

modernizr, webpack, loader

readme (leia-me)

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.

  1. 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")
    }
  }
};
  1. 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")
    }
  }
};
  1. 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'
      }
    ]
  }
};

Related

Contribution

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

Changelog

License

changelog (log de mudanças)

Change Log

All notable changes to this project will be documented in this file.

This project adheres to Semantic Versioning.

5.0.0 - 2019-02-04

  • Changed: drop support for webpack < 4
  • Changed: drop support for node < 6.9
  • Chore: minimum required modernizr version is now ^3.7.1.

4.0.1 - 2018-02-13

  • Build: add node@9 to travis CI.
  • Chore: minimum required modernizr version is now ^3.5.0.
  • Chore: support webpack v4.

4.0.0 - 2017-08-25

  • Changed: configuration loading behaviour. See README.md.
  • Fixed: avoid problem when Modernizr already exists.

3.0.1 - 2017-06-20

  • Chore: support webpack v3.
  • Refactor: remove unnecessary legacy webpack v1 code.

3.0.0 - 2017-02-27

  • Fixed: minimum required loader-utils version is now ~1.0.0.
  • Removed: support webpack version 1.

2.0.0 - 2017-02-01

  • Changed: no longer required to transfer options for modernizr using config option.
  • Changed: to load configuration from file, need specify useConfigFile option.
  • Chore: no need to use function encodeURI for query string.

1.0.2 - 2017-01-31

  • Fixed: updated webpack peer dependency to support 2.2.1.

1.0.1

  • Fixed: resolved configuration file only if file passed.

1.0.0

  • Chore: initial public release.