
Security News
vlt 1.5.0 Adds Agent Skills Management
vlt 1.5.0 links skills from JavaScript dependencies to coding agents, with lockfile versioning and Socket data to filter out known malicious packages.
rollup-plugin-common-path-resolver
Advanced tools
rollup-plugin-common-path-resolver is a plugin designed for the Rollup bundling tool, aimed at improving the efficiency of resolving common paths in projects. Through custom configuration, this plugin can intelligently resolve and share code between different parts of a project, making it particularly suitable for large projects or multi-package repositories. Its main purpose is to support flexible code reuse in large projects or multi-package management scenarios (such as Monorepo structures), especially in scenarios where development is based on a standard product version. When it is necessary to import code or functionality modules from the standard version to build a specific product version, this plugin can offer great convenience and efficiency.
Imagine you are maintaining a product with multiple versions, such as a standard version and several customized versions. Each version needs to reuse a large amount of code and components from the standard version while adding some specific functions or modifying certain features. Using rollup-plugin-common-path-resolver, you can easily share and reuse code between different parts of the project by simply configuring path resolution rules, without the need for complex relative path imports, making code management more concise and efficient.
Using npm:
npm install rollup-plugin-common-path-resolver --save-dev
Using yarn:
yarn add rollup-plugin-common-path-resolver --dev
Using pnpm:
pnpm add rollup-plugin-common-path-resolver --dev
In the Rollup configuration file, import and configure rollup-plugin-common-path-resolver:
import commonPathResolver from 'rollup-plugin-common-path-resolver';
export default {
// Other configurations...
plugins: [
commonPathResolver({
// Configuration options
packagePathSegment: 'packages',
sourcePathSegment: 'src',
commonFolderName: 'common',
pathPrefix: '@',
})
]
};
string): The example path segment is used to locate packages within the project as well as the path to common packages. The default is 'packages'.string): The source code path segment, usually the directory where source code is stored in the project. Default is 'src'.string): The name of the common folder, used for directories sharing code. Default is 'common'.string): The path prefix, used to replace the source path prefix. Default is '@'.RegExp): A regular expression to exclude specific paths, which will not be processed by the plugin.Suppose your project structure is as follows:
my-project/
module1/
src/
index.js
module2/
src/
index.js
common/
src/
utils.js
You can use the rollup-plugin-common-path-resolver plugin, configuring the path prefix @ to point to the common directory, thus easily sharing the utils.js file between module1 and module2.
To better understand how to use rollup-plugin-common-path-resolver, it is recommended to check out the project's packages directory. There, you will find more detailed sample code that can help you quickly get started and gain a deeper understanding of how to use this plugin.
If you encounter any problems or have suggestions for improvement, feel free to raise an issue or pull request in the project's GitHub repository.
This project is licensed under the MIT License. For detailed information, please see the LICENSE file.
FAQs
[English](README.md) | [中文](README_CN.md)
We found that rollup-plugin-common-path-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
vlt 1.5.0 links skills from JavaScript dependencies to coding agents, with lockfile versioning and Socket data to filter out known malicious packages.

Security News
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.