Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sect/modernizr-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sect/modernizr-loader

use modernizr with webpack easily

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by31.53%
Maintainers
1
Weekly downloads
 
Created
Source

@sect/modernizr-loader

npm version MIT license

NPM

Get your Modernizr build bundled with webpack.
This Repos forked from peerigon/modernizr-loader.

Features

  • Support webpack 5

Install

$ npm install --save-dev modernizr @sect/modernizr-loader json-loader

Initialization

You have to create a .modernizrrc configuration file and put your modernizr stuff in it. Like so

// .modernizrrc
{
  "minify": true,
  "options": [
    "setClasses"
  ],
  "feature-detects": []
}

Full list of supported "options" and "feature-detects" can be found in Modernizr config-all.json.

Webpack config

Documentation: Using loaders

Put the following code to your webpack config file:

const path = require('path');

module.exports = {
  module: {
    rules: [
      {
        test: /\.modernizrrc.js$/,
        use: [ '@sect/modernizr-loader' ]
      },
      {
        test: /\.modernizrrc(\.json)?$/,
        use: [ '@sect/modernizr-loader', 'json-loader' ]
      }
    ]
  },
  resolve: {
    alias: {
      modernizr$: path.resolve(__dirname, "path/to/.modernizrrc")
    }
  }
}

Usage

Now you are able to import your custom Modernizr build as a module throughout your application like so:

import Modernizr from 'modernizr';

if (!Modernizr.promises) {
    // ...
}

See the Modernizr documentation for all available options.

Changelog

See CHANGELOG file.

License

See LICENSE file.

Keywords

FAQs

Package last updated on 22 Apr 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc