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

taro-plugin-howxm

v0.0.3

Published

> 用于解决在taro中使用 **浩客问卷** 小程序的时候会遇到问卷无法弹出的问题

Downloads

1

Readme

taro-plugin-howxm

用于解决在taro中使用 浩客问卷 小程序的时候会遇到问卷无法弹出的问题

背景

taro在打包的时候将引用到的<howxm-widget />全部打包到了模板文件中,在业务代码中只引用了1次,但是在模板文件中相关的template却有10多个。

因此在弹出的时候, 会遇到一个报错:component is not attached on current page,这就是当前页面没有找到howxm-widget的组件模板导致的。

查找官方issue,找到一个问题taro使用webpack5进行开发时编译后, 报错找不到模板, 尝试了下面的解决方案,都未解决。

临时解决方案

手动将<howxm-widget />引入到打包后的*.wxml文件中,所有功能可正常使用。

最终解决方案

在taro官方没有好的解决方案之前,为了防止每次build后开发人员需要手动copy的这个过程,写了这个插件,在build之后自动添加<howxm-widget /> 到对应的文件中。

使用

Install

在Taro的项目根目录下安装

yarn add taro-plugin-howxm --dev
// or
npm install taro-plugin-howxm --save-dev

Config

修改项目 config/index.js 中的 plugins 配置为如下:

const config = {
    ...
    plugins: ['taro-plugin-howxm']
    ...
}

配置项

插件可以接受如下参数:

| 参数 | 类型 | 用途 | 必填 | 默认值 | |---------------|----------|----------------------|-----|------------------| | fileExtension | string[] | 原文件后缀 | 非必填 | ['.tsx', '.jsx'] | | appId | string | 应用Id,解决偶发小程序初始化失败 | 非必填 | - | | pageFolders | string[] | 需要增加插件的文件目录 | 非必填 | ['pages'] |

如果想要处理的文件类型不是默认的,那么可以配置此项,会覆盖默认的文件类型,配置如下:

const config = {
    ...
    plugins: [['taro-plugin-howxm', {
        fileExtensions: ['.tsx', '.jsx'],
        // taro存在独立分包,因此提供此配置供用户可以自定义需要插入插件的目录,默认为 ['pages']
        pageFolders: ['pages', 'moduleA']
    }]]
    ...
}