/strict-loader

:customs: Webpack loader adding an `use strict;` statement

Primary LanguageJavaScriptMIT LicenseMIT

strict-loader

npm downloads travis deps

Adds use strict; in the beginning of each source

✔️ Webpack 2 compatible

Please note that if you use Babel, the strict transformer automatically places a "use strict"; directive at the top of your files. In this case you don't need strict-loader.

Install

$ npm install --save strict-loader

Usage

inline

require('strict!./yourmom.js');

webpack config

module.exports = {
  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'strict'
      }
    ]
  }
};

Options

generateSourceMapFromTokens

Generate source map from tokens using esprima. See #8 for details.

demo

npm install
npm start

Open http://localhost:8080/ in browser — you should see text strict-loader is working

License

MIT