
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
vconsole-webpack-plugin
Advanced tools
webpack plugin for vConsole
帮助开发者在移动端进行调试,本插件是在 vConsole 的基础上封装的 webpack
插件,通过 webpack
配置即可自动添加 vConsole
调试功能,方便实用。
npm install vconsole-webpack-plugin --save-dev
webpack.conf.js
文件配置里增加以下插件配置即可
// 引入插件
var vConsolePlugin = require('vconsole-webpack-plugin');
module.exports = {
...
plugins: [
new vConsolePlugin({
filter: [], // 需要过滤的入口文件
enable: true // 发布代码前记得改回 false
}),
...
]
...
}
vConsole
作为一个调试模块,注定了需要在发布前把它去掉,为了避免人为操作失误而影响线上功能,这里建议配置如下:
package.json
文件配置:
scripts: {
"dev": "webpack -w --debug",
"prod": "webpack -p"
}
webpack.conf.js
配置:
// 引入插件
var vConsolePlugin = require('vconsole-webpack-plugin');
// 接收运行参数
const argv = require('yargs')
.describe('debug', 'debug 环境') // use 'webpack --debug'
.argv;
module.exports = {
...
plugins: [
new vConsolePlugin({enable: !!argv.debug}),
...
]
...
}
这样,在开发的时候运行 npm run dev
,发布的时候运行 npm run prod
即可。
webpack-dev-server
的配套用法:
用法其实跟上面一样,只是别忘记在启动脚本的时候增加 --debug
即可。如下:
// package.json
"scripts": {
...
"start:dev": "webpack-dev-server --debug",
...
},
当然,有时候一些页面想临时添加 vconsole
来调试一下,可以直接使用:
<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
window.vConsole = new window.VConsole();
</script>
FAQs
webpack plugin for vConsole
The npm package vconsole-webpack-plugin receives a total of 447 weekly downloads. As such, vconsole-webpack-plugin popularity was classified as not popular.
We found that vconsole-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.