![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@rushstack/hashed-folder-copy-plugin
Advanced tools
Webpack plugin for copying a folder to the output directory with a hash in the folder name.
npm install @rushstack/hashed-folder-copy-plugin --save-dev
This webpack plugin provides a simple method for copying a folder to the build output and including a hash in the folder's name, accessible to the bundle's runtime.
In your Webpack config, include the plugin in your plugins
array:
import { HashedFolderCopyPlugin } from '@rushstack/hashed-folder-copy-plugin';
{
plugins: [
new HashedFolderCopyPlugin()
]
}
and call the requireFolder
function in your webpack bundle:
const folderUrl = requireFolder({
outputFolder: 'my-folder-name_[hash]',
sources: [
{
globsBase: '../assets/',
globs: ['**/*.png']
}
]
})
TypeScript typings are provided for the requireFolder
function:
import type { IRequireFolderOptions } from '@rushstack/hashed-folder-copy-plugin';
declare function requireFolder(options: IRequireFolderOptions): string;
const folderUrl: string = requireFolder({
outputFolder: 'my-folder-name_[hash]',
sources: [
{
globsBase: '../assets/',
globPatterns: ['**/*.png']
}
]
})
The requireFolder
takes an options object with two properties:
outputFolder
This is the name of the folder to be created in the webpack output folder. Its
name supports a [hash]
token, which will be replaced with a stable hash of the assets
that are copied to the folder. Note that the [hash]
token is not required.
sources
This is an array of glob base paths and glob patterns that will be copied to the
output folder. Each entry in this array takes a globsBase
property, which is the
base path to the folder to be copied, and a globPatterns
property, which is an array of
glob patterns to be evaluated under the globsBase
folder. The path in globsBase
supports standard Node resolution.
See the example project.
To get the requireFolder
function type to work in TypeScript, include a reference to
"@rushstack/hashed-folder-copy-plugin/ambientTypes"
in your tsconfig.json
file's
compilerOptions.types
property. For example:
{
"compilerOptions": {
"types": [
"webpack-env",
"@rushstack/hashed-folder-copy-plugin/ambientTypes" // This value, specifically
]
}
}
FAQs
Webpack plugin for copying a folder to the output directory with a hash in the folder name.
The npm package @rushstack/hashed-folder-copy-plugin receives a total of 28 weekly downloads. As such, @rushstack/hashed-folder-copy-plugin popularity was classified as not popular.
We found that @rushstack/hashed-folder-copy-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.