Skip to content

Split preprocessing and compiling into separate plugins #729

@benmccann

Description

@benmccann

Describe the problem

I'd like to use https://github.com/antfu/vite-plugin-inspect to see the result of preprocessing. It shows the result of each Vite plugin. Since preprocessing and compiling currently happen in the same plugin it shows them occurring as a single step

Describe the proposed solution

Split preprocessing and compiling into separate plugins.

I took a quick stab splitting them into separate methods (but still within a single plugin) here: https://github.com/benmccann/vite-plugin-svelte/tree/split-preprocessing. It seems I broke the tests with my attempt. It'd probably be better for someone more familiar with the codebase to do it

Alternatives considered

We could split each preprocessor into its own plugin. I think this would be more trouble than it's worth though. E.g. right now Svelte combines the source maps from all the preprocessors. We'd have to do the same and ensure we were giving the same results as Svelte. I think it'd be a lot easier to handle all preprocessors together in a single plugin and that will still provide a lot of value.

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions