Skip to content

[Feature]: Request to support renderBuiltUrl like vite #2741

Open
@zydmayday

Description

@zydmayday

What problem does this feature solve?

We are currently using vite and have this config in our app.
refer doc: https://vitejs.dev/guide/build.html#advanced-base-options
-> experimental.renderBuiltUrl

I searched in doc and there is no renderBuiltUrl in rebuild.
So even I followed the migration doc(https://rsbuild.dev/guide/migration/vite) and finished most of them,
finally I stucked with "experimental.renderBuiltUrl".

So I wonder if rsbuild is going to support this feature or not,
or if you have any alternatives to this.
Thanks!

// some sample code
// in our vite.config.js
experimental: {
  renderBuildUrl(filename, { hostType }) {
    if (['css', 'js'].includes(hostType)) {
      return {runtime: window.__getFile(filename)}
    }
    return {relative: true}
  }
}
// in our index.html
<script>
  window.__getFile = function (file) {
    return `${window.OTHERS.PREFIX}/${file}`;
  }
</script>

What does the proposed API look like?

I would like to have the same feature with what vite currently has.
Or if you can design with a better way.

vite doc to refer: https://vitejs.dev/guide/build.html#advanced-base-options

Let me know if you need more information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions