A parcel plugin that helps you remove the hash from the file name
npm install parcel-namer-hashless--no-content-hash in package.json.
npm i parcel-namer-hashless -D
yarn add parcel-namer-hashless -D
pnpm add parcel-namer-hashless -D
/ .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
``