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

parcel-namer-hashless

v1.0.7

Published

A parcel plugin that helps you remove the hash from the file name

Downloads

980

Readme

npm

Feature

This plugin will help you remove the hash from a bundle file name(only support parcel v2.x).

Note: since v1.0.4, need your parcel >= v2.8.3

Why

If you are using parcel to package files, you may encounter the following situations. When you package index.html that references other files, parcel treats those files as shared bundles and adds a hash to the file name by default, even if you set --no-content-hash in package.json.

So when you need a filename without any hash value, using this plugin can help you. For example, when you are developing a web browser extension, you need all file names to be stable and hashless

Installation

npm: npm i parcel-namer-hashless -D

yarn: yarn add parcel-namer-hashless -D

pnpm: pnpm add parcel-namer-hashless -D

Useage

Edit .parcelrc file to add new namer:

/* .parcelrc */
{
  "extends": "@parcel/config-default",
  "namers": [ "parcel-namer-hashless" ]
}

Configuration

parcel-namer-hashless exists as an optional field in package.json.

If you want to remove the hash values of all filenames, ignore this field.

If you want precise control over certain files, you can configure the include or exclude field

  • include: string[]: The file that you want to remove the hash from
  • exclude: string[]: The file that you don't want to remove the hash from

use regular expressions

// package.json

"parcel-namer-hashless": {
    "include": [".js$", ".css$", '.card.png$']
}
// or
"parcel-namer-hashless": {
    "exclude": [".css$"]
}
// or
"parcel-namer-hashless": {
  "include": [".js$", ".css$", '.card.png$']
  "exclude": [".background.png$"]
}
 

mode allows you to control which environments take effect

  • mode: 'all' | 'development' | 'production': production as default.
// package.json

"parcel-namer-hashless": {
    "include": [".js$", ".css$", '.card.png$'],
    "mode": 'all'
}

log allows you to disable logging info.

  • log: true | false: true as default
// package.json

"parcel-namer-hashless": {
    "log": false
}

Result

If you run the plugin successfully, the terminal will output:

parcel-namer-hashless: index.794a6267.js -> index.js

Issue

  • Error: Bundles must have unique names: There is a tag in your index.html file. In this case, parcel will generate a index.js file. So if you have another tag to import 'main.ts', parcel will generate two index.js file. But we should notice that the first index.js file will not output as a file in your dist. So i delete your first tag, then everything works fine.