3.0.5 • Published 12 months ago

monic-loader v3.0.5

Weekly downloads
72
License
MIT
Repository
github
Last release
12 months ago

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.

3.0.4

1 year ago

3.0.3

1 year ago

3.0.5

12 months ago

3.0.2

4 years ago

3.0.1

7 years ago

3.0.0

8 years ago

2.2.6

9 years ago

2.2.5

9 years ago

2.2.4

9 years ago

2.2.3

9 years ago

2.2.2

9 years ago

2.2.1

10 years ago

2.2.0

10 years ago

2.1.0

10 years ago

2.0.5

10 years ago

2.0.4

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago