Skip to content

DmitryMakhnev/annotation-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

#annotation-loader

webpack annotation loader

Installation

npm install --save-dev annotation-loader

Usage

for test.js

var foo = {};

/*@bar*/
console.log('bar');
/*@/bar*/

var bar = {};

/*@bar2*/
console.log('bar2');
/*@/bar2*/

with config

var webpack = require('webpack');

module.exports = {
    entry:  './entry.js',
    output: {
        path: __dirname,
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            {
                test: /^.*$/,
                loader: "annotation",
                annotations: [
                    {
                        'for': 'bar',
                        'do': ''
                    },
                    {
                        'for': 'bar2',
                        'do': function (str, $1) {
                            //$1 is content of annotation 
                            return '//annotation removed';
                        }
                    }
                ]
            }
        ]
    }
};

you get

var foo = {};

var bar = {};

//annotation removed

Use for

Use to remove tests exports or some code for dev mode in production

##Licence

MIT

About

webpack annotation loader

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published