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

wxmini-plugin-webpack

v1.0.13

Published

wx miniprogram plugin

Downloads

9

Readme

wxmini-plugin-webpack

webpack5版本的微信小程序插件,让微信原生小程序的开发也能变成工程化。

使用

npm -i -D wxmini-plugin-webpack

js-template 案例

ts-template 案例

优势/好处

  • 1.可以区分不同的环境变量,dev, production开发环境等等

  • 2.无用代码筛检,剔除

  • 3.@importrequire<wxs src'@src/test.wxs'></wxs>, json文件的组件引入 可以用别名引入,如@src, @common等

  • 4.代码体积小,不会像uniapp, Taro,产生大量运行代码

  • 5.支持ts,支持es6语法的import export deufalt

注意事项

  • 子的.less的文件如果引入在父页面的less中,会合并到一个文件,.wxss文件后缀用@import引入的文件,不会合并一个文件

  • 只有两个公共js文件,runtime.jscommon.js

生产模式输出文件信息

图片

webpack配置

// webpack配置

const  MiniProgramPlugin  = require('wxmini-plugin-webpack').plugin

module.exports = {
    ...,
    ...,
    module: {
      rules: [
        {
          test: /\.wxml$/,
          type: 'asset/resource',
          generator: {
            filename: '[path][name][ext]'
          },
          use: [
            'wxmini-plugin-webpack'
          ]
        },
        {
          test: /\.json/,
          type: 'asset/resource',
          generator: {
            filename: '[path][name][ext]'
          },
          use: [
            'wxmini-plugin-webpack'
          ]
        },
        {
          test: /\.wxs$/,
          type: 'asset/resource',
          generator: {
            filename: '[path][name][ext]'
          },
          use: ['wxmini-plugin-webpack']
        },
        {
          test: /\.wxss/,
          type: 'asset/resource',
          generator: {
            filename: '[path][name][ext]'
          },
          use: ['wxmini-plugin-webpack']
        },
        ...,
        ...,
        ...
      ]
      },
    plugins: [
        new MiniProgramPlugin()
    ],
    ...,
    ...,
    ...
}

To-do

代办事项

  • [x] wxss文件代码压缩
  • [x] 输出打包文件信息
  • [x] 显示打包进度

本地调试

安装依赖
npm i

// 运行脚本
node example/build-examples.js resolve-template
或者
npm run dev
npm run build
npm源切换

npm config get registry

npm config set registry https://registry.npmjs.org/

npm config set registry https://registry.npmmirror.com

qq讨论群: 475870039