webpack-strip-block
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -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 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4008
5
66
2
+ Addedloader-utils@^1.1.0
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/source-map@0.3.6(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@types/eslint@9.6.1(transitive)
+ Added@types/eslint-scope@3.7.7(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/node@22.10.2(transitive)
+ Added@webassemblyjs/ast@1.14.1(transitive)
+ Added@webassemblyjs/floating-point-hex-parser@1.13.2(transitive)
+ Added@webassemblyjs/helper-api-error@1.13.2(transitive)
+ Added@webassemblyjs/helper-buffer@1.14.1(transitive)
+ Added@webassemblyjs/helper-numbers@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-section@1.14.1(transitive)
+ Added@webassemblyjs/ieee754@1.13.2(transitive)
+ Added@webassemblyjs/leb128@1.13.2(transitive)
+ Added@webassemblyjs/utf8@1.13.2(transitive)
+ Added@webassemblyjs/wasm-edit@1.14.1(transitive)
+ Added@webassemblyjs/wasm-gen@1.14.1(transitive)
+ Added@webassemblyjs/wasm-opt@1.14.1(transitive)
+ Added@webassemblyjs/wasm-parser@1.14.1(transitive)
+ Added@webassemblyjs/wast-printer@1.14.1(transitive)
+ Added@xtuc/ieee754@1.2.0(transitive)
+ Added@xtuc/long@4.2.2(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedajv@6.12.68.17.1(transitive)
+ Addedajv-formats@2.1.1(transitive)
+ Addedajv-keywords@3.5.25.1.0(transitive)
+ Addedbig.js@5.2.2(transitive)
+ Addedbrowserslist@4.24.3(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaniuse-lite@1.0.30001688(transitive)
+ Addedchrome-trace-event@1.0.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedelectron-to-chromium@1.5.73(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedenhanced-resolve@5.17.1(transitive)
+ Addedes-module-lexer@1.5.4(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedglob-to-regexp@0.4.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedjest-worker@27.5.1(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.11.0.0(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedloader-runner@4.3.0(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedschema-utils@3.3.04.3.0(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addedtapable@2.2.1(transitive)
+ Addedterser@5.37.0(transitive)
+ Addedterser-webpack-plugin@5.3.11(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwatchpack@2.4.2(transitive)
+ Addedwebpack@5.97.1(transitive)
+ Addedwebpack-sources@3.2.3(transitive)