You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

js-conditional-compile-loader

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-conditional-compile-loader - npm Package Compare versions

Comparing version
1.0.15
to
1.0.16
+6
-1
index.js

@@ -10,3 +10,8 @@ var loaderUtils = require('loader-utils');

}
return replacer.replaceMatched(source, options)
source = replacer.replaceMatched(source, options)
// changeSource 可修改内容
if (options.changeSource) {
source = options.changeSource(source, options)
}
return source
};

@@ -0,0 +0,0 @@ MIT License

+1
-1
{
"name": "js-conditional-compile-loader",
"version": "1.0.15",
"version": "1.0.16",
"description": "A conditional compiling loader for webpack, support js,ts,css,scss,vue. 一个条件编译的webpack loader,支持js,ts,css,scss,vue等。",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -117,4 +117,14 @@ # js-conditional-compile-loader

- 任意属性名:boolean
- changeSource: Function(source, options)
自定义的修改源码函数。可选。比如对于后端为java环境时,将代码中的`.aspx`替换为`.do`:
````js
var options = {
changeSource: process.env.npm_config_java ? source => source.replace(/\.aspx\b/i, '.do') : null
}
````
- 其他任意属性名:boolean
如果 [属性值] === false,则所有`/\* IFTRUE_属性名` 和 `FITRUE_属性名 \*/`之间的代码都会被移除。 其他情况,这些代码则会被保留。

@@ -121,0 +131,0 @@

@@ -113,2 +113,12 @@ # js-conditional-compile-loader

- changeSource: Function(source, options)
Custom function to change source code. Optional. Sample: change `.aspx` to `.do` for java backend:
````js
var options = {
changeSource: process.env.npm_config_java ? source => source.replace(/\.aspx\b/i, '.do') : null
}
````
- \[any propertyName\]:{bool}

@@ -115,0 +125,0 @@ if [propertyValue] === false, all codes between `/\* IFTRUE_propertyName` and `FITRUE_propertyName \*/` will be removed, otherwise the codes will be remained.

@@ -0,0 +0,0 @@ var REG = /\/\*\s*IF(DEBUG|TRUE_\w+)(?:\s*\*\/)?([\s\S]+?)(?:\/\*\s*)?FI\1\s*\*\//g;