@wroud/vite-plugin-asset-resolver
is a flexible Vite plugin that resolves asset imports by mapping 'dist' directories to 'src' directories, supporting custom file extensions. It enables custom asset resolution when Vite’s default behavior fails, particularly for complex project structures.
-
Custom Asset Resolution: Resolves asset imports (e.g., images, SVG) from
src
instead ofdist
. -
Multiple Aliases: Supports custom aliases for both
src
anddist
directories. - Custom Extensions: Allows configuring which file extensions should be resolved.
Install via npm:
npm install @wroud/vite-plugin-asset-resolver
Install via yarn:
yarn add @wroud/vite-plugin-asset-resolver
For detailed usage and API reference, visit the documentation site.
import { defineConfig } from "vite";
import { assetResolverPlugin } from "@wroud/vite-plugin-asset-resolver";
export default defineConfig({
plugins: [
assetResolverPlugin({
dist: ["dist", "build"],
src: ["src", "source"],
extensions: [".svg", ".png", ".jpg"],
}),
],
});
All notable changes to this project will be documented in the CHANGELOG file.
This project is licensed under the MIT License. See the LICENSE file for details.