Skip to content

[2.x] Minified JS files in jsDirectory not being copied to assets #4328

@imorland

Description

@imorland

Current Behavior

jsDirectory files are not being copied to the assets directory when MIME type detection incorrectly identifies JavaScript files as a different type. This commonly occurs with minified or bundled JS files. The compiler relies solely on MIME type checking, which is unreliable in Flysystem for certain JS file contents. Extensions defining jsDirectory only for the common frontend are particularly affected, as their files are silently skipped during compilation.

Steps to Reproduce

  1. Create an extension that defines jsDirectory for the common frontend with minified JavaScript files
  2. Enable the extension
  3. Clear the cache using php flarum cache:clear
  4. Access the forum or admin frontend
  5. Check the public/assets/js/extension-id/ directory - the expected JavaScript files will be missing

Expected Behavior

The JavaScript files from the extension's jsDirectory should be copied to the public/assets/js/extension-id/ directory and be accessible for lazy loading by the frontend application.

Screenshots

No response

Environment

  • Flarum version: x.y.z
  • Website URL: http://example.com
  • Webserver: [e.g. apache, nginx]
  • Hosting environment: [e.g. shared, vps]
  • PHP version: x.y.z
  • Browser: [e.g. chrome 67, safari 11]

Output of php flarum info

Output of "php flarum info", run this in terminal in your Flarum directory.

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions