npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mobile-webpackplugin-for-consoledebug

v2.0.3

Published

webpack plugin for mobile console debug

Downloads

3

Readme

Github:Mobile-webpackPlugin-for-consoleDebug

webpack-server-qrcode移动端扫码预览webpack插件

Description

移动端调试debug plugin

Demo

demo demo1 demo2 demo3

use

cnpm i mobile-webpackplugin-for-consoledebug  ——D

webpack.config.js

const consoleDebugWebpackPlugin = require('mobile-webpackplugin-for-consoledebug');

...

module.exports = {
    plugins: [
        new consoleDebugWebpackPlugin()
    ]
};

Vue.config.js

const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV); //生产环境
const IS_DEV = ['development', 'dev'].includes(process.env.NODE_ENV); //开发环境
let path = require('path')
let package = require('./package.json')
let glob = require('glob')
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const fs = require('fs-extra')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');    //清除注释
const consoleDebugWebpackPlugin = require('mobile-webpackplugin-for-consoledebug');   //移动端调试
const WebpackServerQRcode = require('@ice-point/webpack-server-qrcode');    //移动端扫码
//配置pages多页面获取当前文件夹下的html和js
function getEntry(globPath) {
	let entries = {};
	glob.sync(globPath).forEach(function(entry) {
		var tmp = entry.split('/').splice(-3);
		console.log(tmp)
		entries[tmp[1]] = {
			entry: 'src/' + tmp[0] + '/' + tmp[1] + '/index.js',
			template: 'src/' + tmp[0] + '/' + tmp[1] + '/' + tmp[2],
			filename: tmp[1] + '.html'
		};
	});
	return entries;
}

let pages = getEntry('./src/pages/**?/*.html');
console.log(pages)

module.exports = {
	lintOnSave: false, //禁用eslint
	baseUrl: process.env.NODE_ENV === "production" ? `//www.mycdn.cn/${package.name}/` : '/',
	productionSourceMap: false,
	pages,
	devServer: {
		disableHostCheck: true,
		index: '/', //默认启动serve 打开/页面
		open: process.platform === 'darwin',
		host: '',
		port: 9527,
		https: false,
		hotOnly: false,
		before: app => {
			app.get('/', (req, res, next) => {
				for(let i in pages) {
					res.write(`<a target="_self" href="/${i}.html">/${i}.html</a></br>`);
				}
				res.end()
			});
			app.get('/mock/:goods/:list', (req, res, next) => { //mock数据
				var json = fs.readJsonSync('./src/mock/index.json')
				var {params,query} = req;
				res.status(299).json({json,params,query}).end();
			})
		}
	},
	configureWebpack: config => {
		console.log(config)
		config.devServer={    //显示二维码需要此配置
			host: '0.0.0.0'
		}
		config.performance = {   //禁止打包警告
			hints: false
		}
		var plugins=[];
		if(IS_DEV){
			plugins=[new consoleDebugWebpackPlugin(),new WebpackServerQRcode()];
		}
		
		plugins.push( //清除控制台打印
			new UglifyJsPlugin({
				uglifyOptions: {
					compress: {
						// 在UglifyJs删除没有用到的代码时不输出警告
						warnings: false,
						// 删除所有的 `console` 语句,可以兼容ie浏览器
						drop_console: true,
						drop_debugger: true,
						// 内嵌定义了但是只用到一次的变量
						collapse_vars: true,
						// 提取出出现多次但是没有定义成变量去引用的静态值
						reduce_vars: true,
						pure_funcs: ['console.log'] //移除console
					},
					output: {
						// 最紧凑的输出
						beautify: false,
						// 删除所有的注释
						comments: false,
					}
				},
				sourceMap: false,
				parallel: true
			})
		);
		config.plugins = [
			...config.plugins,
			...plugins
		];
	}
}