🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

webpack-strip-block

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-strip-block - npm Package Compare versions

Comparing version

to
0.2.0

.npmignore

6

index.js

@@ -7,5 +7,5 @@ /*jslint node:true */

function StripBlockLoader(content) {
var query = this.query && typeof this.query === 'string' ? loaderUtils.parseQuery(this.query) : {};
var startComment = query.start || 'develblock:start';
var endComment = query.end || 'develblock:end';
var options = loaderUtils.getOptions(this) || {};
var startComment = options.start || 'develblock:start';
var endComment = options.end || 'develblock:end';

@@ -12,0 +12,0 @@ var regexPattern = new RegExp("[\\t ]*\\/\\* ?" + startComment + " ?\\*\\/[\\s\\S]*?\\/\\* ?" + endComment + " ?\\*\\/[\\t ]*\\n?", "g");

{
"name": "webpack-strip-block",
"version": "0.1.1",
"version": "0.2.0",
"description": "Webpack plugin to strip blocks of code that's only intended for development purposes",

@@ -26,3 +26,9 @@ "main": "index.js",

}],
"license": "MIT"
"license": "MIT",
"peerDependencies": {
"webpack": ">=2.2.0"
},
"dependencies": {
"loader-utils": "^1.1.0"
}
}
Webpack Strip Block
===================
Webpack loader to strip blocks of code marked by special comment tags
Webpack loader to strip blocks of code marked by special comment tags. Useful for removing code that you don't want in your production webpack bundle (e.g. verbose console warnings, etc).

@@ -26,29 +26,25 @@ ###Example:

In your webpack config:
In your webpack config, specify the loader:
```javascript
{
module: {
loaders: [
{ test: /\.js$/, loader: "webpack-strip-block" }
]
module.exports = {
rules: [
{
test: /\.js$/,
enforce: 'pre',
exclude: /(node_modules|bower_components|\.spec\.js)/,
use: [
{
loader: 'webpack-strip-block'
}
]
}
};
]
}
```
It is also possible to overwrite the `start` and `end` variables with url-encoded string values:
```javascript
{
module: {
loaders: [
{ test: /\.js$/, loader: "webpack-strip-block?start=DEV-START&end=DEV-END" }
]
}
};
```
If you want to use custom comment tags to mark the start and end of the block to strip from your code, you can add options for "start" and "end" like this:
### Webpack 2
```javascript
{
module.exports = {
rules: [

@@ -60,3 +56,8 @@ {

use: [
'webpack-strip-block?start=devcode:start&end=devcode:end'
{
loader: 'webpack-strip-block',
options: {
start: 'DEV-START',
end: 'DEV-END'
}
]

@@ -63,0 +64,0 @@ }