https://github.com/mistadikay/strict-loader
:customs: Webpack loader adding an `use strict;` statement
https://github.com/mistadikay/strict-loader
javascript webpack webpack-loader
Last synced: 5 months ago
JSON representation
:customs: Webpack loader adding an `use strict;` statement
- Host: GitHub
- URL: https://github.com/mistadikay/strict-loader
- Owner: mistadikay
- License: mit
- Created: 2015-02-28T18:35:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-03-03T17:22:43.000Z (over 6 years ago)
- Last Synced: 2025-12-22T19:43:50.039Z (6 months ago)
- Topics: javascript, webpack, webpack-loader
- Language: JavaScript
- Homepage:
- Size: 56.6 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# strict-loader
[](https://www.npmjs.com/package/strict-loader)
[](https://www.npmjs.com/package/strict-loader)
[](https://travis-ci.org/mistadikay/strict-loader)
[](https://david-dm.org/mistadikay/strict-loader)
> Adds `use strict;` in the beginning of each source
:heavy_check_mark: Webpack 2 compatible
Please note that if you use Babel, the strict transformer [automatically places](https://babeljs.io/docs/plugins/transform-strict-mode/) 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
``` javascript
require('strict!./yourmom.js');
```
### webpack config
``` javascript
module.exports = {
module: {
loaders: [
{
test: /\.js$/,
loader: 'strict'
}
]
}
};
```
### Options
#### `generateSourceMapFromTokens`
Generate source map from tokens using esprima. See [#8](https://github.com/mistadikay/strict-loader/pull/8) for details.
### demo
```
npm install
npm start
```
Open `http://localhost:8080/` in browser — you should see text `strict-loader is working`
## License
MIT