{"library":"modernizr-loader","title":"modernizr-loader","description":"A webpack loader that enables importing custom Modernizr builds as modules. Version 1.0.1 requires modernizr ^3.1.0 as a peer dependency. Maintained by peerigon. Unlike manual builds, this integrates seamlessly with webpack's module system, allowing feature detection to be bundled conditionally. The loader reads a .modernizrrc (JSON or JS) configuration file. Breaking change in 1.0.0: Modernizr is no longer attached to window; must import as a module. Supports webpack 1 and 2, but webpack 1 requires json-loader for JSON configs.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install modernizr-loader"],"cli":null},"imports":["import Modernizr from 'modernizr';","// .modernizrrc (JSON or JS) with feature-detects and options","resolve: { alias: { modernizr$: path.resolve(__dirname, 'path/to/.modernizrrc') } }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// .modernizrrc\n{\n  \"minify\": true,\n  \"options\": [\"setClasses\"],\n  \"feature-detects\": [\"test/svg\", \"test/promises\"]\n}\n\n// webpack.config.js\nconst path = require('path');\n\nmodule.exports = {\n  module: {\n    loaders: [\n      {\n        test: /\\.modernizrrc\\.js$/,\n        loader: \"modernizr\"\n      },\n      {\n        test: /\\.modernizrrc(\\.json)?$/,\n        loader: \"modernizr!json\"\n      }\n    ]\n  },\n  resolve: {\n    alias: {\n      modernizr$: path.resolve(__dirname, \".modernizrrc\")\n    }\n  }\n};\n\n// app.js\nimport Modernizr from 'modernizr';\n\nif (!Modernizr.svg) {\n  // fallback\n}","lang":"javascript","description":"Shows setup of .modernizrrc config, webpack loader rules for JS and JSON configs, alias, and usage in app.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}