Socket
Socket
Sign inDemoInstall

@sect/modernizr-loader

Package Overview
Dependencies
40
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sect/modernizr-loader

use modernizr with webpack easily


Version published
Weekly downloads
586
decreased by-38.77%
Maintainers
1
Install size
33.1 kB
Created
Weekly downloads
 

Changelog

Source

v1.0.5 (2023-04-22)

Full Changelog

Readme

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

Last updated on 22 Apr 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc