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 🙏

© 2025 – Pkg Stats / Ryan Hefner

module-tag-remove

v0.0.1

Published

change vite build

Readme

[![Version][npm-version-shield]][npm] [![Build][github-ci-shield]][github-ci] [![License][license-shield]][license]

About

在打包为离线包的情况下,使用@vitejs/plugin-legacy后,script标签包含了module属性和nomodule 属性,但是type = module的情况下,不能支持本地文件路径,所以直接打开会报错。

删除掉带有type=modulescript标签,同时我们要去掉scriptnomodule的属性,这样兼容传统浏览器的脚本在现代浏览器下也可以执行。

git clone https://github.com/posthtml/posthtml-plugin-starter.git

Features

  • Tests with ava
  • Linting with xo
  • Releases with np
  • Coverage with c8
  • CI with GitHub Actions

Tests

The testing boilerplate includes a process() method which accepts 4 parameters:

  • t the test object
  • name the file name of the fixture/expected files, excluding extension
  • options any options to pass to the plugin when testing
  • log a boolean that turns on logging to console

For example, imagine we're writing a test that uses /test/fixtures/skip-nodes.html:

test('It skips nodes defined in `skipNodes` option', t => {
  return process(t, 'skip-nodes', {skipNodes: ['a']}, true)
})

As you can see, the second parameter passed to the process() method is the fixture file name, without the .html extension.

Testing for Errors

To test errors thrown by your plugin, use the error() method:

test('Syntax error', t => {
  return error('syntax-error', err => {
    t.is(err.message, 'Invalid or unexpected token')
  })
})

Just like before, the first parameter passed to error() is the fixture file name, without the extension.

Introduction

删除vite打包后的部分script和移除nomodule属性

Input:

<script type="module">xxxxx</script>
<script nomodule id="vite-legacy-polyfill" src="./assets/polyfills-legacy.1b8c3f41.js"></script>

Output:

<script id="vite-legacy-polyfill" src="./assets/polyfills-legacy.1b8c3f41.js"></script>

Install

$ npm i posthtml module-tag-remove

Usage

Provide clear code samples showing how to use the plugin:

import posthtml from'posthtml'
import removeScript from 'module-tag-remove'

let result = posthtml().use(plugin()).process(html, { sync: true }).html