Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

monic-loader

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monic-loader

Using Monic with WebPack.

latest
Source
npmnpm
Version
3.0.5
Version published
Maintainers
0
Created
Source

monic-loader

Using Monic with WebPack.

NPM version

Install

# WebPack 1
npm install monic monic-loader@webpack1 --save-dev

# WebPack 2+
npm install monic monic-loader --save-dev

Usage

Webpack 1

webpack.config.json

var webpack = require('webpack');

webpack({
  entry: {
      index: './index.js'
  },

  output: {
      filename: '[name].bundle.js'
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'monic-loader?flags=ie:7|develop&labels=full|baz'
      }
    ]
  },

  monic: {
    replacers: [
      // Replaces require to #include
      // ("this" refers to the instance of the compiler)
      function (text, file) {
        return text.replace(/^\s*require\('(.*?)'\);/gm, '//#include $1');
      }
    ]
  }

}, function (err, stats) {
    // ...
});

Webpack 2+

webpack.config.json

var webpack = require('webpack');

webpack({
  entry: {
      index: './index.js'
  },

  output: {
      filename: '[name].bundle.js'
  },

  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            // Can be used: monic-loader?flags=ie:7|develop&labels=full|baz
            loader: 'monic-loader',
            options: {
              flags: ['ie:7', 'develop'],
              labels: ['full', 'baz'],
              replacers: [
                // Replaces require to #include
                // ("this" refers to the compiler' instance)
                function (text, file) {
                  return text.replace(/^\s*require\('(.*?)'\);/gm, '//#include $1');
                }
              ]
            }
          }
        ]
      }
    ]
  }

}, function (err, stats) {
    // ...
});

Options

License

The MIT License.

Keywords

webpack

FAQs

Package last updated on 09 Aug 2024

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