Skip to content

Add an asset pipeline hook for script transforms #11580

Description

@swernerx

What would help

Remix v3 currently has a good server-side extension point through the Node loader chain. That lets integrations transform server-loaded TypeScript/JavaScript modules before execution.

Browser-delivered modules go through the Remix asset pipeline instead. As far as I can tell in beta.5, there is no public script transform extension point there, so integrations that need to rewrite application source cannot support the browser/client side without wrapping createAssetServer or proxying in front of it.

A documented asset-pipeline transform hook would make that path much cleaner.

Use cases

  • compile i18n macros for browser-delivered app modules
  • add framework-agnostic source transforms that need to run in both server and browser module graphs
  • preserve source maps and watch invalidation without reimplementing Remix asset serving

Shape that would be useful

  • receives module URL/path, source, format, and current source map if one exists
  • can return transformed source plus source map
  • runs only for app/source modules, not arbitrary dependencies unless explicitly opted in
  • participates in dev invalidation/watch behavior
  • documents ordering relative to Remix TS/JSX lowering

For context: this came up while building a server-first Remix v3 i18n integration. The server side can work through node --import remix/node-tsx --import ..., but client-side macro parity is blocked until there is an asset-pipeline hook or an equivalent first-party API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions