github remix-run/remix assets@0.6.0
assets v0.6.0

3 hours ago

Minor Changes

  • BREAKING CHANGE: In createAssetServer, replace the fileMap option with optional directory-based mounts. Mounts recursively preserve the path beneath each public and filesystem root, keeping module URLs aligned with the filesystem hierarchy used for package resolution.

    When mounts is omitted, the asset server uses { app: 'app', npm: 'node_modules' }.

    To migrate an app whose fileMap is equivalent to the new defaults, remove the fileMap option entirely:

    // before
    createAssetServer({
      basePath: '/assets',
      fileMap: {
        '/app/*path': 'app/*path',
        '/npm/*path': 'node_modules/*path',
      },
      // ...
    })
    
    // after
    createAssetServer({
      basePath: '/assets',
      // ...
    })

    To migrate custom fileMap rules that preserve directory hierarchy, remove the trailing wildcard from both sides and rename fileMap to mounts:

    // before
    createAssetServer({
      basePath: '/assets',
      fileMap: {
        '/source/*path': 'app/*path',
        '/vendor/*path': 'node_modules/*path',
      },
      // ...
    })
    
    // after
    createAssetServer({
      basePath: '/assets',
      mounts: {
        source: 'app',
        vendor: 'node_modules',
      },
      // ...
    })
  • Add assetServer.getAssets() for listing browser-reachable files and assetServer.getAssetDetails(urlOrFile) for inspecting URL mappings, file types, access rules, and reachability status. These APIs use the asset server's configured mapping and access policy, so diagnostic results match request handling (see #11726).

Don't miss a new remix release

NewReleases is sending notifications on new releases.