webpack-modernizr-loader
Get your modernizr build bundled with webpack.
Installation
$ npm install webpack-modernizr-loader --save-dev
Usage
There are three use case.
- Using loader
options
.
const modernizr = ;
webpack.config.js
moduleexports = 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 ;
- Using config file through alias (supported JavaScript and JSON syntax).
const modernizr = ;
.modernizrrc.js
moduleexports = options: "setClasses" "feature-detects": "test/css/flexbox" "test/es6/promises" "test/serviceworker" ;
webpack.config.js
moduleexports = 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 ;
- Using config (supported JavaScript and JSON syntax) file directly (see below example how it is use).
const modernizr = ;
webpack.config.js
moduleexports = module: rules: loader: "webpack-modernizr-loader" test: /\.modernizrrc\.js$/ // Uncomment this when you use `JSON` format for configuration // type: 'javascript/auto' ;
Related
- Modernizr - API for this module
Contribution
Feel free to push your code if you agree with publishing under the MIT license.