Skip to content

Consider to trigger neccessary Rollup Output Hooks in serve mode #5756

@morlay

Description

@morlay

Clear and concise description of the problem

Now in serve mode, Vite only trigger resolveId -> load -> transform and return transformed code as a vistable file.

In fact, a vistable file should be a chunk too.

Without trigger neccessary Rollup Output Hooks,
some rollup plugins, which using this.emitFile and import.meta.ROLLUP_FILE_URL_${refID}, coudn't work well in Vite.

Suggested solution

Please consider to trigger the neccessary Rollup Output Hooks in serve mode
resolveFileUrl/resolveImportMeta -> renderChunk.

A simple hack here https://github.com/morlay/vite-presets/blob/main/src/plugin-context.ts#L72-L111
now just trigger the related hook in same plugin.

Need Vite to add this feature for support all plugins.

Alternative

No response

Additional context

No response

Validations

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