Skip to content

feat!: support redirect.asset.path and redirect.asset.extension #1119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025

Conversation

Timeless0911
Copy link
Contributor

@Timeless0911 Timeless0911 commented Jul 16, 2025

Summary

Small breaking changes about redirect.asset.

boolean -> { path?: boolean; extension?: boolean; }

redirect.asset

Controls the redirect of the import paths of output asset files.

redirect.asset.path

Whether to automatically redirect the import paths of asset output files.

  • Type: boolean
  • Default: true

When set to true, the relevant redirect rules are the same as redirect.js.path.

When set to false, the original import path will remain unchanged.

  • Example:
import url from '@/assets/logo.svg'; // source code of './src/foo.ts' ↓
import url from './assets/logo.svg'; // expected output of './dist/foo.js'

redirect.asset.extension

Whether to automatically redirect the file extension to import paths based on the asset output files.

  • Type: boolean
  • Default: true

When set to true, the paths of imported asset files will be redirected to the corresponding JavaScript output file.

When set to false, the file extension will remain unchanged from the original import path.

  • Example:
import url from './assets/logo.svg'; // source code of './src/foo.ts' ↓
import url from './assets/logo.mjs'; // expected output of './dist/foo.js'

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit 9eb23a9
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/687799008c4b470008a5091c
😎 Deploy Preview https://deploy-preview-1119--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Timeless0911 Timeless0911 marked this pull request as draft July 17, 2025 16:08
@fi3ework fi3ework marked this pull request as ready for review July 21, 2025 07:27
@Timeless0911 Timeless0911 merged commit f6e761c into main Jul 21, 2025
14 checks passed
@Timeless0911 Timeless0911 deleted the feat/asset-redirect branch July 21, 2025 07:37
@Timeless0911 Timeless0911 mentioned this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy