Liferay NPM Bundler Copy Loader

2.32.2 · active · verified Sun Apr 19

This package, `liferay-npm-bundler-loader-copy-loader`, serves as a specialized loader for `liferay-npm-bundler`, designed to facilitate the copying of files within a Liferay frontend project's build process. It allows developers to define rules in their `.npmbundlerrc` configuration to copy assets, such as images, fonts, or other static files, from a specified source to the output directory. The current stable version is 2.32.2. While specific release cadence for this individual loader is not explicitly stated, it is part of the larger Liferay frontend projects monorepo, which appears to have an active and ongoing release schedule across its various components. Its primary differentiator is its tight integration with the Liferay build tooling, providing a declarative way to manage asset copying specifically within that ecosystem.

Common errors

Warnings

Install

Imports

Quickstart

This configuration snippet for `.npmbundlerrc` demonstrates how to use `liferay-npm-bundler-loader-copy-loader` to copy different types of assets (images, fonts, documents, and specific files) from various source paths to designated `dest` directories within the Liferay module output.

// .npmbundlerrc
{
  "rules": [
    {
      "test": "^assets/images/.*\\.(png|jpe?g|gif|svg)$",
      "use": ["copy-loader"],
      "dest": "images"
    },
    {
      "test": "^assets/fonts/.*\\.(woff|woff2|eot|ttf|otf)$",
      "use": ["copy-loader"],
      "dest": "fonts"
    },
    {
      "test": "^assets/documents/.*\\.(pdf|doc|docx)$",
      "use": ["copy-loader"],
      "dest": "documents"
    },
    {
      "test": "^assets/misc/somefile.txt",
      "use": ["copy-loader"],
      "dest": "static"
    }
  ]
}

view raw JSON →